Index: _modules/sas/perspectives/calculator.html
===================================================================
--- _modules/sas/perspectives/calculator.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,140 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../index.html" />
+    <link rel="up" title="Module code" href="../../index.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../index.html" accesskey="U">Module code</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator</h1><div class="highlight"><pre>
+<span class="n">PLUGIN_ID</span> <span class="o">=</span> <span class="s">&quot;Calculator plug-in 1.0&quot;</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">from</span> <span class="nn">distutils.filelist</span> <span class="kn">import</span> <span class="n">findall</span>
+<span class="kn">from</span> <span class="nn">calculator</span> <span class="kn">import</span> <span class="o">*</span>
+<span class="n">N_DIR</span> <span class="o">=</span> <span class="mi">12</span>
+<div class="viewcode-block" id="get_data_path"><a class="viewcode-back" href="../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.get_data_path">[docs]</a><span class="k">def</span> <span class="nf">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c"># Check for data path in the package</span>
+    <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">),</span> <span class="n">media</span><span class="p">)</span>
+    <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+        <span class="k">return</span> <span class="n">path</span>
+    <span class="c"># Check for data path next to exe/zip file.</span>
+    <span class="c"># If we are inside a py2exe zip file, we need to go up</span>
+    <span class="c"># two levels to get to the directory containing the exe</span>
+    <span class="c"># We will check if the exe and the xsf are in the same</span>
+    <span class="c"># directory.</span>
+    <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">)</span>
+    <span class="c">#Look for maximum n_dir up of the current dir to find media</span>
+   
+    <span class="c">#for i in range(n_dir):</span>
+    <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
+    <span class="k">while</span><span class="p">(</span><span class="n">i</span> <span class="o">&lt;</span> <span class="n">N_DIR</span><span class="p">):</span>
+        <span class="n">path</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">media_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">media</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">media_path</span><span class="p">):</span>
+             <span class="n">module_media_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">media_path</span><span class="p">,</span><span class="s">&#39;calculator_</span><span class="si">%s</span><span class="s">&#39;</span><span class="o">%</span> <span class="n">media</span><span class="p">)</span>
+             <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">module_media_path</span><span class="p">):</span>
+                 <span class="k">return</span> <span class="n">module_media_path</span>
+             <span class="k">return</span> <span class="n">media_path</span>
+        <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
+   
+    <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&#39;Could not find calculator media files&#39;</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="data_files"><a class="viewcode-back" href="../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_files">[docs]</a><span class="k">def</span> <span class="nf">data_files</span><span class="p">():</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Return the data files associated with media calculator.</span>
+<span class="sd">    </span>
+<span class="sd">    The format is a list of (directory, [files...]) pairs which can be</span>
+<span class="sd">    used directly in setup(...,data_files=...) for setup.py.</span>
+
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">data_files</span> <span class="o">=</span> <span class="p">[]</span>
+    <span class="n">path</span> <span class="o">=</span> <span class="n">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&quot;media&quot;</span><span class="p">)</span>
+    <span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">findall</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+        <span class="n">data_files</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">&#39;media/calculator_media&#39;</span><span class="p">,</span> <span class="p">[</span><span class="n">f</span><span class="p">]))</span>
+    <span class="k">return</span> <span class="n">data_files</span></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../index.html" >Module code</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/aperture_editor.html
===================================================================
--- _modules/sas/perspectives/calculator/aperture_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/aperture_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,505 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.aperture_editor &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.aperture_editor</h1><div class="highlight"><pre>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">deepcopy</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.loader</span> <span class="kn">import</span> <span class="n">Loader</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">check_float</span>
+
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">60</span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">450</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">290</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">480</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">530</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">320</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    
+<span class="k">class</span> <span class="nc">ApertureDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+<div class="viewcode-block" id="ApertureDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog">[docs]</a>    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">aperture</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Dialog allows to enter values for aperture</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">)</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Aperture Editor&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span> <span class="o">=</span> <span class="n">aperture</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_aperture</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">aperture</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="c">#self_description = &quot;Edit aperture&quot;</span>
+        
+        <span class="c">#Attributes for panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_name_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_aperture</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_aperture</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">size_name_tcl</span>  <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">type_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">size_name_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_size_unit_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_size_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_name_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">type_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_unit_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_aperture_size_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_aperture_size_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_aperture_size_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+      
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        define initial sizer </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_aperture</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="s">&quot;Aperture&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_aperture</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_aperture</span><span class="p">,</span> 
+                                                   <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">type_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">size_name_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_size_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+ 
+    <span class="k">def</span> <span class="nf">_layout_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for aperture name related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Aperture name [string]</span>
+        <span class="n">aperture_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Aperture Name : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_name_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">5</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                              <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">aperture_name_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">aperture_name_tcl</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">EXPAND</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_layout_type</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the  layout for aperture type  related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Aperture type [string]</span>
+        <span class="n">type_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Type: &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">type_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">type_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">type_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">type_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_distance</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the  layout for aperture distance related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Aperture distance [float]</span>
+        <span class="n">distance_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Distance:&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> 
+                                        <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>   
+        <span class="n">distance_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                             <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">distance_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distance_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                <span class="p">(</span><span class="n">distance_unit_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distance_unit_tcl</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">EXPAND</span><span class="p">)])</span>  
+    <span class="k">def</span> <span class="nf">_layout_size_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the  layout for size name related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Size name [string]</span>
+        <span class="n">size_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Size Name : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">size_name_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">5</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                          <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">size_name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">size_name_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">size_name_tcl</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">EXPAND</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_size</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the  layout for aperture size related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Aperture size [Vector]</span>
+        <span class="n">aperture_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Size:&#39;</span><span class="p">)</span> 
+        <span class="n">x_aperture_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;x = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_aperture_size_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                               <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">y_aperture_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;y = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_aperture_size_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">z_aperture_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;z = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_aperture_size_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="n">aperture_size_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_size_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                                <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_size_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">aperture_size_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">x_aperture_size_txt</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">LEFT</span><span class="p">,</span> <span class="mi">17</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_aperture_size_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">y_aperture_size_txt</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">EXPAND</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_aperture_size_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">z_aperture_size_txt</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">EXPAND</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_aperture_size_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">aperture_size_unit_txt</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">EXPAND</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">aperture_size_unit_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;Apply&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_apply</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Apply current changes to aperture.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;Cancel&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Cancel current changes.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_cancel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span><span class="s">&#39;Close&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close window.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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">LEFT</span><span class="p">,</span> <span class="mi">200</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span> <span class="p">):</span><span class="c">#, data=None):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw the current panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_type</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_distance</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_size_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_size</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_aperture</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">type_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distance_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">size_name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">aperture_size_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_aperture</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span>
+<div class="viewcode-block" id="ApertureDialog.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.set_manager">[docs]</a>        <span class="sd">&quot;&quot;&quot;    </span>
+<span class="sd">        Set manager of this window</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        
+    <span class="k">def</span> <span class="nf">reset_aperture</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ApertureDialog.reset_aperture"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.reset_aperture">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        put the default value of the detector back to the current aperture</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_aperture</span><span class="o">.</span><span class="n">name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_aperture</span><span class="o">.</span><span class="n">type</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_aperture</span><span class="o">.</span><span class="n">size_name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">y</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">z</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size_unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_aperture</span><span class="o">.</span><span class="n">size_unit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">distance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_aperture</span><span class="o">.</span><span class="n">distance</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">distance_unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_aperture</span><span class="o">.</span><span class="n">distance_unit</span>
+        
+    <span class="k">def</span> <span class="nf">set_values</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ApertureDialog.set_values"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.set_values">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        take the aperture values of the current data and display them</span>
+<span class="sd">        through the panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">aperture</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span>
+        <span class="c">#Name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">aperture</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+        <span class="c">#Type</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">type_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">aperture</span><span class="o">.</span><span class="n">type</span><span class="p">))</span>
+        <span class="c">#distance</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">aperture</span><span class="o">.</span><span class="n">distance</span><span class="p">))</span>
+        <span class="c">#distance unit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">aperture</span><span class="o">.</span><span class="n">distance_unit</span><span class="p">))</span>
+        <span class="c">#Size name </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">size_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">aperture</span><span class="o">.</span><span class="n">size_name</span><span class="p">))</span>
+        <span class="c">#Aperture size as a vector</span>
+        <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span> <span class="o">=</span> <span class="n">aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">y</span><span class="p">,</span> <span class="n">aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">z</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_aperture_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_aperture_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">y</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_aperture_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_size_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">aperture</span><span class="o">.</span><span class="n">size_unit</span><span class="p">))</span>
+    
+    <span class="k">def</span> <span class="nf">get_aperture</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ApertureDialog.get_aperture"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.get_aperture">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the current aperture</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span>
+    
+    <span class="k">def</span> <span class="nf">get_notes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ApertureDialog.get_notes"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.get_notes">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return notes</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span>
+    
+    <span class="k">def</span> <span class="nf">on_change_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ApertureDialog.on_change_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.on_change_name">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change the name of the aperture</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">name</span> <span class="o">!=</span> <span class="n">name</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change sample &#39;s &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;name from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+            
+    <span class="k">def</span> <span class="nf">on_change_type</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ApertureDialog.on_change_type"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.on_change_type">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change aperture type</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change type </span>
+        <span class="nb">type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">type_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="nb">type</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change type from&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="nb">type</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">on_change_distance</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ApertureDialog.on_change_distance"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.on_change_distance">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change distance of the aperture</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change distance</span>
+        <span class="n">distance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">distance_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">distance</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">distance</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">distance</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">distance</span> <span class="o">=</span> <span class="n">distance</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distance_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">distance</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">distance</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change distance from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">distance</span><span class="p">,</span> 
+                                                  <span class="n">distance</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">distance</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">distance</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for distance  &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes distance from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">distance</span><span class="p">,</span> <span class="n">distance</span><span class="p">)</span>
+        <span class="c">#change the distance unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">distance_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">distance_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change distance &#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">distance_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">on_change_size_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ApertureDialog.on_change_size_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.on_change_size_name">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change the size&#39;s name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change size name</span>
+        <span class="n">size_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">size_name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size_name</span> <span class="o">=</span> <span class="n">size_name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change size name from&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size_name</span><span class="p">,</span> <span class="n">size_name</span><span class="p">)</span>
+   
+    <span class="k">def</span> <span class="nf">on_change_size</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ApertureDialog.on_change_size"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.on_change_size">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change aperture size</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change x coordinate</span>
+        <span class="n">x_aperture_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_aperture_size_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">x_aperture_size</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">x_aperture_size</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">x_aperture_size</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_aperture_size_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">x</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_aperture_size</span><span class="p">)</span> <span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change x of aperture size from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                                   <span class="n">x_aperture_size</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">aperture_size</span><span class="o">.</span><span class="n">x</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_aperture_size</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; float for the aperture size &#39;s x &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes x aperture size from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> 
+                                           <span class="n">x_aperture_size</span><span class="p">)</span>
+        <span class="c">#Change y coordinate</span>
+        <span class="n">y_aperture_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_aperture_size_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">y_aperture_size</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">y_aperture_size</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">y_aperture_size</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">y_aperture_size</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_aperture_size_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">y</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_aperture_size</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change y of aperture size from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                                   <span class="n">y_aperture_size</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">y</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_aperture_size</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; aperture size&#39;s y &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes y aperture size from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                            <span class="n">y_aperture_size</span><span class="p">)</span>
+        <span class="c">#Change z coordinate</span>
+        <span class="n">z_aperture_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_aperture_size_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">z_aperture_size</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">z_aperture_size</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">z_aperture_size</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="n">z_aperture_size</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_aperture_size_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">z</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_aperture_size</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change z of aperture size from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                                   <span class="n">z_aperture_size</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">z</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_aperture_size</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the offset &#39;s x &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes z aperture size from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                            <span class="n">z_aperture_size</span><span class="p">)</span>
+        <span class="c">#change the aperture center unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_size_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change aperture size&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="o">.</span><span class="n">size_unit</span> <span class="o">=</span> <span class="n">unit</span>
+                 
+    <span class="k">def</span> <span class="nf">on_click_apply</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ApertureDialog.on_click_apply"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.on_click_apply">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Apply user values to the aperture</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_type</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_distance</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_size_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_size</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">set_aperture</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            
+    <span class="k">def</span> <span class="nf">on_click_cancel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ApertureDialog.on_click_cancel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.aperture_editor.ApertureDialog.on_click_cancel">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        reset the current aperture to its initial values</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_aperture</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+             <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">set_aperture</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_aperture</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+ 
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div></div>
+   
+    <span class="n">app</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">()</span>
+    <span class="c"># Instantiate a loader </span>
+    <span class="n">loader</span> <span class="o">=</span> <span class="n">Loader</span><span class="p">()</span>
+    <span class="c"># Load data </span>
+    <span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Aperture</span>
+    <span class="n">ap</span> <span class="o">=</span> <span class="n">Aperture</span><span class="p">()</span>
+    <span class="n">dlg</span> <span class="o">=</span> <span class="n">ApertureDialog</span><span class="p">(</span><span class="n">aperture</span><span class="o">=</span><span class="n">ap</span><span class="p">)</span>
+    <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>
+ 
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/calculator.html
===================================================================
--- _modules/sas/perspectives/calculator/calculator.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/calculator.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,346 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.calculator &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.calculator</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Calculator Module</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation. </span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2010, University of Tennessee</span>
+<span class="c">################################################################################</span>
+
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.plugin_base</span> <span class="kn">import</span> <span class="n">PluginBase</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.data_operator</span> <span class="kn">import</span> <span class="n">DataOperatorWindow</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.data_editor</span> <span class="kn">import</span> <span class="n">DataEditorWindow</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.kiessig_calculator_panel</span> <span class="kn">import</span> <span class="n">KiessigWindow</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.sld_panel</span> <span class="kn">import</span> <span class="n">SldWindow</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.density_panel</span> <span class="kn">import</span> <span class="n">DensityWindow</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.slit_length_calculator_panel</span> \
+            <span class="kn">import</span> <span class="n">SlitLengthCalculatorWindow</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.resolution_calculator_panel</span> \
+            <span class="kn">import</span> <span class="n">ResolutionWindow</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.gen_scatter_panel</span> <span class="kn">import</span> <span class="n">SasGenWindow</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.image_viewer</span> <span class="kn">import</span> <span class="n">ImageView</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.pyconsole</span> <span class="kn">import</span> <span class="n">PyConsole</span>
+<span class="kn">import</span> <span class="nn">logging</span>
+
+<div class="viewcode-block" id="Plugin"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin">[docs]</a><span class="k">class</span> <span class="nc">Plugin</span><span class="p">(</span><span class="n">PluginBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    This class defines the interface for a Plugin class</span>
+<span class="sd">    for calculator perspective</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">standalone</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+        <span class="n">PluginBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&quot;Calculator&quot;</span><span class="p">,</span> <span class="n">standalone</span><span class="o">=</span><span class="n">standalone</span><span class="p">)</span>
+        <span class="c"># Log startup</span>
+        <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Calculator plug-in started&quot;</span><span class="p">)</span>   
+        <span class="bp">self</span><span class="o">.</span><span class="n">sub_menu</span> <span class="o">=</span> <span class="s">&quot;Tool&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_edit_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># data operator use one frame all the time</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_operator_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">kiessig_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cal_md_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cal_slit_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cal_res_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">gen_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">image_view</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">py_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        
+<div class="viewcode-block" id="Plugin.help"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.help">[docs]</a>    <span class="k">def</span> <span class="nf">help</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show a general help dialog. </span>
+<span class="sd">        </span>
+<span class="sd">        :TODO: replace the text with a nice image</span>
+<span class="sd">            provide more hint on the SLD calculator</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">help_panel</span> <span class="kn">import</span>  <span class="n">HelpWindow</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">HelpWindow</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> 
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">frame</span><span class="p">,</span> <span class="s">&quot;IsIconized&quot;</span><span class="p">):</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">frame</span><span class="o">.</span><span class="n">IsIconized</span><span class="p">():</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">icon</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">GetIcon</span><span class="p">()</span>
+                    <span class="n">frame</span><span class="o">.</span><span class="n">SetIcon</span><span class="p">(</span><span class="n">icon</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>  
+        <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="Plugin.get_tools"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.get_tools">[docs]</a>    <span class="k">def</span> <span class="nf">get_tools</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Returns a set of menu entries for tools</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data_oper_help</span> <span class="o">=</span> <span class="s">&quot;Perform arithmetic data operation (+...) &quot;</span>
+        <span class="n">data_oper_help</span> <span class="o">+=</span> <span class="s">&quot;and combination (|)&quot;</span>
+        <span class="n">kiessig_help</span> <span class="o">=</span> <span class="s">&quot;Approximately computes the &quot;</span>
+        <span class="n">kiessig_help</span> <span class="o">+=</span> <span class="s">&quot;thickness of a shell or the size of &quot;</span>
+        <span class="n">kiessig_help</span> <span class="o">+=</span> <span class="s">&quot;particles </span><span class="se">\n</span><span class="s"> from the width of a Kiessig fringe.&quot;</span>
+        <span class="n">sld_help</span> <span class="o">=</span> <span class="s">&quot;Computes the Scattering Length Density.&quot;</span>
+        <span class="n">slit_length_help</span> <span class="o">=</span> <span class="s">&quot;Computes the slit length from the beam profile.&quot;</span>
+        <span class="n">resolution_help</span> <span class="o">=</span> <span class="s">&quot;Approximately estimates the &quot;</span>
+        <span class="n">resolution_help</span> <span class="o">+=</span> <span class="s">&quot;resolution of Q in 2D based on the SAS &quot;</span>
+        <span class="n">resolution_help</span> <span class="o">+=</span> <span class="s">&quot;instrumental parameter values.&quot;</span>
+        <span class="n">mass_volume_help</span> <span class="o">=</span> <span class="s">&quot;Based on the chemical formula, &quot;</span>
+        <span class="n">mass_volume_help</span> <span class="o">+=</span> <span class="s">&quot;compute the mass density or the molar volume.&quot;</span>
+        <span class="n">gensas_help</span> <span class="o">=</span> <span class="s">&quot;Generic SAS&quot;</span>
+        <span class="n">pyconsole_help</span> <span class="o">=</span> <span class="s">&quot;Python Console.&quot;</span>
+        <span class="n">imageviewer_help</span> <span class="o">=</span> <span class="s">&quot;Load an image file and display the image.&quot;</span>
+        <span class="c">#data_editor_help = &quot;Meta Data Editor&quot;</span>
+        <span class="k">return</span> <span class="p">[(</span><span class="s">&quot;Data Operation&quot;</span><span class="p">,</span> 
+                        <span class="n">data_oper_help</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_data_operation</span><span class="p">),</span>
+                <span class="p">(</span><span class="s">&quot;SLD Calculator&quot;</span><span class="p">,</span> <span class="n">sld_help</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_calculate_sld</span><span class="p">),</span>
+                <span class="p">(</span><span class="s">&quot;Density/Volume Calculator&quot;</span><span class="p">,</span> <span class="n">mass_volume_help</span><span class="p">,</span> 
+                                            <span class="bp">self</span><span class="o">.</span><span class="n">on_calculate_dv</span><span class="p">),</span>
+                <span class="p">(</span><span class="s">&quot;Slit Size Calculator&quot;</span><span class="p">,</span> <span class="n">slit_length_help</span><span class="p">,</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">on_calculate_slit_size</span><span class="p">),</span>
+                <span class="p">(</span><span class="s">&quot;Kiessig Thickness Calculator&quot;</span><span class="p">,</span> 
+                        <span class="n">kiessig_help</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_calculate_kiessig</span><span class="p">),</span>
+                          <span class="p">(</span><span class="s">&quot;SAS Resolution Estimator&quot;</span><span class="p">,</span> 
+                        <span class="n">resolution_help</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_calculate_resoltuion</span><span class="p">),</span>
+                <span class="p">(</span><span class="s">&quot;Generic Scattering Calculator&quot;</span><span class="p">,</span> 
+                        <span class="n">gensas_help</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_gen_model</span><span class="p">),</span>
+                <span class="p">(</span><span class="s">&quot;Python Shell/Editor&quot;</span><span class="p">,</span> <span class="n">pyconsole_help</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_python_console</span><span class="p">),</span>
+                <span class="p">(</span><span class="s">&quot;Image Viewer&quot;</span><span class="p">,</span> <span class="n">imageviewer_help</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_image_viewer</span><span class="p">),]</span>
+              </div>
+<div class="viewcode-block" id="Plugin.on_edit_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.on_edit_data">[docs]</a>    <span class="k">def</span> <span class="nf">on_edit_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Edit meta data </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_edit_frame</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_edit_frame</span> <span class="o">=</span> <span class="n">DataEditorWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                                                    <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="p">[],</span>
+                                                    <span class="n">title</span><span class="o">=</span><span class="s">&quot;Data Editor&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_edit_frame</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_edit_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>    
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_edit_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+              </div>
+<div class="viewcode-block" id="Plugin.on_data_operation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.on_data_operation">[docs]</a>    <span class="k">def</span> <span class="nf">on_data_operation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Data operation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_operator_frame</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c"># Use one frame all the time</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_operator_frame</span> <span class="o">=</span> <span class="n">DataOperatorWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                                                <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> 
+                                                <span class="n">title</span><span class="o">=</span><span class="s">&quot;Data Operation&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_operator_frame</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_operator_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_operator_frame</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">set_panel_on_focus</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_operator_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Plugin.on_calculate_kiessig"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.on_calculate_kiessig">[docs]</a>    <span class="k">def</span> <span class="nf">on_calculate_kiessig</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Compute the Kiessig thickness</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">kiessig_frame</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">frame</span> <span class="o">=</span> <span class="n">KiessigWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">kiessig_frame</span> <span class="o">=</span> <span class="n">frame</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">kiessig_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">kiessig_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span> 
+        </div>
+<div class="viewcode-block" id="Plugin.on_calculate_sld"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.on_calculate_sld">[docs]</a>    <span class="k">def</span> <span class="nf">on_calculate_sld</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Compute the scattering length density of molecula</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_frame</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">frame</span> <span class="o">=</span> <span class="n">SldWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                                  <span class="n">base</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sld_frame</span> <span class="o">=</span> <span class="n">frame</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sld_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span> 
+    </div>
+<div class="viewcode-block" id="Plugin.on_calculate_dv"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.on_calculate_dv">[docs]</a>    <span class="k">def</span> <span class="nf">on_calculate_dv</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Compute the mass density or molar voulme</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cal_md_frame</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">frame</span> <span class="o">=</span> <span class="n">DensityWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                                  <span class="n">base</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cal_md_frame</span> <span class="o">=</span> <span class="n">frame</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cal_md_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cal_md_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span> 
+              </div>
+<div class="viewcode-block" id="Plugin.on_calculate_slit_size"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.on_calculate_slit_size">[docs]</a>    <span class="k">def</span> <span class="nf">on_calculate_slit_size</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Compute the slit size a given data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cal_slit_frame</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">frame</span> <span class="o">=</span> <span class="n">SlitLengthCalculatorWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>  
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cal_slit_frame</span> <span class="o">=</span> <span class="n">frame</span> 
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cal_slit_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>     
+        <span class="bp">self</span><span class="o">.</span><span class="n">cal_slit_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Plugin.on_calculate_resoltuion"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.on_calculate_resoltuion">[docs]</a>    <span class="k">def</span> <span class="nf">on_calculate_resoltuion</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Estimate the instrumental resolution</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cal_res_frame</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">frame</span> <span class="o">=</span> <span class="n">ResolutionWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cal_res_frame</span> <span class="o">=</span> <span class="n">frame</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cal_res_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cal_res_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span> 
+        </div>
+<div class="viewcode-block" id="Plugin.on_gen_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.on_gen_model">[docs]</a>    <span class="k">def</span> <span class="nf">on_gen_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Generic model menu event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">gen_frame</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">frame</span> <span class="o">=</span> <span class="n">SasGenWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">gen_frame</span> <span class="o">=</span> <span class="n">frame</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">gen_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">gen_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span> 
+</div>
+<div class="viewcode-block" id="Plugin.on_image_viewer"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.on_image_viewer">[docs]</a>    <span class="k">def</span> <span class="nf">on_image_viewer</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get choose an image file dialog</span>
+<span class="sd">        </span>
+<span class="sd">        :param event: menu event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">image_view</span> <span class="o">=</span> <span class="n">ImageView</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">image_view</span><span class="o">.</span><span class="n">load</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="Plugin.on_python_console"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.on_python_console">[docs]</a>    <span class="k">def</span> <span class="nf">on_python_console</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Open Python Console</span>
+<span class="sd">        </span>
+<span class="sd">        :param event: menu event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">get_python_panel</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Plugin.get_python_panel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.get_python_panel">[docs]</a>    <span class="k">def</span> <span class="nf">get_python_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the python shell panel</span>
+<span class="sd">        </span>
+<span class="sd">        :param filename: file name to open in editor</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">py_frame</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">frame</span> <span class="o">=</span> <span class="n">PyConsole</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> 
+                              <span class="n">filename</span><span class="o">=</span><span class="n">filename</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">py_frame</span> <span class="o">=</span> <span class="n">frame</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">py_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">py_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span> 
+        </div>
+<div class="viewcode-block" id="Plugin.put_icon"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator.Plugin.put_icon">[docs]</a>    <span class="k">def</span> <span class="nf">put_icon</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">frame</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Put icon in the frame title bar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">frame</span><span class="p">,</span> <span class="s">&quot;IsIconized&quot;</span><span class="p">):</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">frame</span><span class="o">.</span><span class="n">IsIconized</span><span class="p">():</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">icon</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">GetIcon</span><span class="p">()</span>
+                    <span class="n">frame</span><span class="o">.</span><span class="n">SetIcon</span><span class="p">(</span><span class="n">icon</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>      </div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/calculator_widgets.html
===================================================================
--- _modules/sas/perspectives/calculator/calculator_widgets.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/calculator_widgets.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,193 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.calculator_widgets &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.calculator_widgets</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">This software was developed by the University of Tennessee as part of the</span>
+<span class="sd">Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="sd">project funded by the US National Science Foundation. </span>
+
+<span class="sd">See the license text in license.txt</span>
+
+<span class="sd">copyright 2009, University of Tennessee</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="n">CHILD_FRAME</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MDIChildFrame</span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+    <span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;darwin&quot;</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+        <span class="n">CHILD_FRAME</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span>
+
+<div class="viewcode-block" id="InputTextCtrl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator_widgets.InputTextCtrl">[docs]</a><span class="k">class</span> <span class="nc">InputTextCtrl</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Text control for model and fit parameters.</span>
+<span class="sd">        Binds the appropriate events for user interactions.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        
+        <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        
+        <span class="c">## Set to True when the mouse is clicked while the whole </span>
+        <span class="c">#string is selected</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">## Call back for EVT_SET_FOCUS events</span>
+        <span class="n">_on_set_focus_callback</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># Bind appropriate events</span>
+        <span class="bp">self</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_LEFT_UP</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_highlight_text</span><span class="p">)</span>
+        <span class="bp">self</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_SET_FOCUS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_set_focus</span><span class="p">)</span>
+        <span class="bp">self</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">parent</span><span class="o">.</span><span class="n">_onparamEnter</span> <span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">_on_set_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Catch when the text control is set in focus to highlight the whole</span>
+<span class="sd">            text if necessary</span>
+<span class="sd">            @param event: mouse event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span> <span class="o">=</span> <span class="bp">True</span>
+        
+    <span class="k">def</span> <span class="nf">_highlight_text</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Highlight text of a TextCtrl only of no text has be selected</span>
+<span class="sd">            @param event: mouse event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Make sure the mouse event is available to other listeners</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">control</span>  <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="c"># Check that we have a TextCtrl</span>
+            <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">control</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span>
+                <span class="c"># Check whether text has been selected, </span>
+                <span class="c"># if not, select the whole string</span>
+                <span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> <span class="o">=</span> <span class="n">control</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">start</span> <span class="o">==</span> <span class="n">end</span><span class="p">:</span>
+                    <span class="n">control</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+
+    </div>
+<div class="viewcode-block" id="InterActiveOutputTextCtrl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator_widgets.InterActiveOutputTextCtrl">[docs]</a><span class="k">class</span> <span class="nc">InterActiveOutputTextCtrl</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Text control used to display outputs.</span>
+<span class="sd">        No editing allowed. The background is </span>
+<span class="sd">        grayed out. User can&#39;t select text.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetParent</span><span class="p">()</span><span class="o">.</span><span class="n">GetBackgroundColour</span><span class="p">())</span>
+        </div>
+<div class="viewcode-block" id="OutputTextCtrl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.calculator_widgets.OutputTextCtrl">[docs]</a><span class="k">class</span> <span class="nc">OutputTextCtrl</span><span class="p">(</span><span class="n">InterActiveOutputTextCtrl</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Text control used to display outputs.</span>
+<span class="sd">        No editing allowed. The background is </span>
+<span class="sd">        grayed out. User can&#39;t select text.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">InterActiveOutputTextCtrl</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetParent</span><span class="p">()</span><span class="o">.</span><span class="n">GetBackgroundColour</span><span class="p">())</span>
+        
+        <span class="c"># Bind to mouse event to avoid text highlighting</span>
+        <span class="c"># The event will be skipped once the call-back</span>
+        <span class="c"># is called.</span>
+        <span class="bp">self</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_MOUSE_EVENTS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_click</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_click</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Prevent further handling of the mouse event</span>
+<span class="sd">            by not calling Skip().</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="k">pass</span>
+
+      </div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/collimation_editor.html
===================================================================
--- _modules/sas/perspectives/calculator/collimation_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/collimation_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,643 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.collimation_editor &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.collimation_editor</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">deepcopy</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.loader</span> <span class="kn">import</span> <span class="n">Loader</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Aperture</span><span class="p">,</span> <span class="n">Collimation</span>
+<span class="kn">from</span> <span class="nn">aperture_editor</span> <span class="kn">import</span> <span class="n">ApertureDialog</span>
+
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">check_float</span>
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">60</span>
+
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">530</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">430</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">550</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">600</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">480</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    
+<div class="viewcode-block" id="CollimationDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog">[docs]</a><span class="k">class</span> <span class="nc">CollimationDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">collimation</span><span class="o">=</span><span class="p">[],</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">)</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Collimation Editor&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span> <span class="o">=</span> <span class="n">collimation</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_collimation</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">collimation</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_description</span> <span class="o">=</span> <span class="s">&quot;Edit collimation&quot;</span>
+        <span class="c">#layout attributes</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_collimation</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_collimation</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+ 
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        define initial sizer </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_collimation</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                            <span class="nb">str</span><span class="p">(</span><span class="s">&quot;Edit Selected Collimation&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_collimation</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_collimation</span><span class="p">,</span>
+                                                       <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        
+        <span class="n">collimation_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Edit Number of Collimations&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">collimation_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_sizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_STATICBOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_button_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_hint_sizer</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>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">length_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+        
+        <span class="n">aperture_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Edit Aperture&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">aperture_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_button_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_hint_sizer</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>
+      
+    <span class="k">def</span> <span class="nf">_layout_collimation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for collimation related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">collimation_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Collimation:&quot;</span><span class="p">)</span> 
+        <span class="n">hint_collimation_txt</span> <span class="o">=</span> <span class="s">&#39;Current available collimation.&#39;</span>
+        <span class="n">collimation_name_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_collimation_txt</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_select_collimation</span><span class="p">)</span> 
+        <span class="n">hint_collimation_name_txt</span> <span class="o">=</span> <span class="s">&#39;Name of collimations.&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_collimation_name_txt</span><span class="p">)</span> 
+   
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_collimation</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Add&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_collimation</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Edit data&#39;s collimation.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_collimation</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">add_collimation</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_collimation</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Remove&quot;</span><span class="p">)</span>
+        <span class="n">hint</span> <span class="o">=</span> <span class="s">&quot;Remove data&#39;s collimation.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_collimation</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_collimation</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">remove_collimation</span><span class="p">)</span>
+      
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">collimation_name_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_add_collimation</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_collimation</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="n">collimation_hint_txt</span> <span class="o">=</span> <span class="s">&#39;No collimation is available for this data.&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">collimation_hint_txt</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_hint_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">collimation_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">collimation_button_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">collimation_hint_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+     
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_collimation_combox</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_collimation</span><span class="p">()</span>
+        
+
+    <span class="k">def</span> <span class="nf">_layout_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for collimation name related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Collimation name [string]</span>
+        <span class="n">name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Name : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">5</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">name_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</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">EXPAND</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_length</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the  layout for length related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Collimation length</span>
+        <span class="n">length_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Length:&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">length_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>   
+        <span class="n">length_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">length_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                           <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">length_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">length_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">length_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">12</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">length_unit_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">length_unit_tcl</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">EXPAND</span><span class="p">)])</span> 
+   
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;Apply&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_apply</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Apply current changes to collimation.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;Cancel&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Cancel current changes.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_cancel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span><span class="s">&#39;Close&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close window.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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">LEFT</span><span class="p">,</span> <span class="mi">200</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_layout_aperture</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for aperture related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">aperture_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Aperture:&quot;</span><span class="p">)</span> 
+        <span class="n">hint_aperture_txt</span> <span class="o">=</span> <span class="s">&#39;Current available aperture.&#39;</span>
+        <span class="n">aperture_name_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_aperture_txt</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="n">hint_aperture_name_txt</span> <span class="o">=</span> <span class="s">&#39;Name of apertures.&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_aperture_name_txt</span><span class="p">)</span> 
+    
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_aperture</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Add&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_aperture</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Edit data&#39;s aperture.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_aperture</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">add_aperture</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit_aperture</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Edit&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit_aperture</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Edit data&#39;s aperture.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit_aperture</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">edit_aperture</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_aperture</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Remove&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_aperture</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Remove data&#39;s aperture.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_aperture</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">remove_aperture</span><span class="p">)</span>
+      
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">aperture_name_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_add_aperture</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_edit_aperture</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_aperture</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="n">aperture_hint_txt</span> <span class="o">=</span> <span class="s">&#39;No aperture is available for this data.&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">aperture_hint_txt</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_hint_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">aperture_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">aperture_button_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">aperture_hint_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_aperture_combox</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_aperture</span><span class="p">()</span>
+    
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw the current panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_collimation</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_length</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_aperture</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+     
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_collimation</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                          <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">length_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">aperture_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">collimation_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_collimation</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="CollimationDialog.get_current_collimation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.get_current_collimation">[docs]</a>    <span class="k">def</span> <span class="nf">get_current_collimation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span>
+        <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span> 
+        <span class="k">if</span> <span class="n">position</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">NOT_FOUND</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span>
+        <span class="n">collimation_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetStringSelection</span><span class="p">()</span> 
+        <span class="n">collimation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">collimation</span><span class="p">,</span> <span class="n">collimation_name</span><span class="p">,</span> <span class="n">position</span>
+    </div>
+<div class="viewcode-block" id="CollimationDialog.fill_collimation_combox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.fill_collimation_combox">[docs]</a>    <span class="k">def</span> <span class="nf">fill_collimation_combox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill the current combobox with the available collimation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span> <span class="o">==</span> <span class="p">[]:</span>
+            <span class="k">return</span>
+        <span class="k">for</span> <span class="n">collimation</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span><span class="p">:</span>
+            <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">,</span> <span class="n">collimation</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+            </div>
+<div class="viewcode-block" id="CollimationDialog.add_collimation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.add_collimation">[docs]</a>    <span class="k">def</span> <span class="nf">add_collimation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Append empty collimation to data&#39;s list of collimation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+        <span class="n">collimation</span> <span class="o">=</span> <span class="n">Collimation</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">collimation</span><span class="p">)</span>
+        <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">collimation</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">position</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_collimation</span><span class="p">()</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_aperture</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_aperture_combox</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_aperture</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="CollimationDialog.remove_collimation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.remove_collimation">[docs]</a>    <span class="k">def</span> <span class="nf">remove_collimation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Remove collimation to data&#39;s list of collimation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+                <span class="n">collimation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">collimation</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">collimation</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">Delete</span><span class="p">(</span><span class="n">position</span><span class="p">)</span> 
+                    <span class="c">#set the combo box box the next available item</span>
+                    <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="n">position</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">position</span> <span class="o">-=</span> <span class="mi">1</span> 
+                    <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>       
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_aperture</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>  
+            <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">length_tcl</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">length_unit_tcl</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="c">#disable or enable the combo box when necessary</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_collimation</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_aperture</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="CollimationDialog.on_select_collimation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.on_select_collimation">[docs]</a>    <span class="k">def</span> <span class="nf">on_select_collimation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill the control on the panel according to </span>
+<span class="sd">        the current  selected collimation </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_aperture_combox</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_aperture</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="CollimationDialog.enable_collimation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.enable_collimation">[docs]</a>    <span class="k">def</span> <span class="nf">enable_collimation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Enable /disable widgets related to collimation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> \
+            <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_collimation</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="n">n_collimation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span>
+            <span class="n">collimation_hint_txt</span> <span class="o">=</span> <span class="s">&quot;collimations&quot;</span>
+            <span class="n">collimation_hint_txt</span> <span class="o">+=</span> <span class="s">&quot; available: </span><span class="si">%s</span><span class="s"> &quot;</span><span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">n_collimation</span><span class="p">)</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_collimation</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_collimation</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_collimation</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="n">collimation_hint_txt</span> <span class="o">=</span> <span class="s">&#39;No collimation is available for this data.&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_txt</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">collimation_hint_txt</span><span class="p">)</span>
+           
+   </div>
+<div class="viewcode-block" id="CollimationDialog.reset_collimation_combobox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.reset_collimation_combobox">[docs]</a>    <span class="k">def</span> <span class="nf">reset_collimation_combobox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">edited_collimation</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        take all edited editor and reset clientdata of collimation combo box</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">position</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()):</span>
+            <span class="n">collimation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">collimation</span> <span class="o">==</span> <span class="n">edited_collimation</span><span class="p">:</span>
+                <span class="n">collimation</span> <span class="o">=</span> <span class="n">edited_collimation</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetString</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+                <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">collimation</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+         </div>
+<div class="viewcode-block" id="CollimationDialog.add_aperture"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.add_aperture">[docs]</a>    <span class="k">def</span> <span class="nf">add_aperture</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Append empty aperture to data&#39;s list of aperture</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">collimation</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_collimation</span><span class="p">()</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+        <span class="n">aperture</span> <span class="o">=</span> <span class="n">Aperture</span><span class="p">()</span>
+        <span class="n">collimation</span><span class="o">.</span><span class="n">aperture</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">aperture</span><span class="p">)</span>
+        <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">aperture</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">aperture</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">position</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_aperture</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="CollimationDialog.edit_aperture"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.edit_aperture">[docs]</a>    <span class="k">def</span> <span class="nf">edit_aperture</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Edit the selected aperture</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="k">return</span> 
+        <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span> 
+        <span class="k">if</span> <span class="n">position</span> <span class="o">!=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NOT_FOUND</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">GetStringSelection</span><span class="p">()</span> 
+            <span class="n">aperture</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+            <span class="n">dlg</span> <span class="o">=</span> <span class="n">ApertureDialog</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">aperture</span><span class="o">=</span><span class="n">aperture</span><span class="p">)</span>
+            <span class="n">dlg</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+            <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+            </div>
+<div class="viewcode-block" id="CollimationDialog.remove_aperture"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.remove_aperture">[docs]</a>    <span class="k">def</span> <span class="nf">remove_aperture</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Remove aperture to data&#39;s list of aperture</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">collimation</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_collimation</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+                <span class="n">aperture</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">aperture</span> <span class="ow">in</span> <span class="n">collimation</span><span class="o">.</span><span class="n">aperture</span><span class="p">:</span>
+                    <span class="n">collimation</span><span class="o">.</span><span class="n">aperture</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">aperture</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">Delete</span><span class="p">(</span><span class="n">position</span><span class="p">)</span> 
+                    <span class="c">#set the combo box box the next available item</span>
+                    <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="n">position</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">position</span> <span class="o">-=</span> <span class="mi">1</span> 
+                    <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+                   
+        <span class="c">#disable or enable the combo box when necessary</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_aperture</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="CollimationDialog.set_aperture"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.set_aperture">[docs]</a>    <span class="k">def</span> <span class="nf">set_aperture</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">aperture</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set aperture for data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">collimation</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_collimation</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">collimation</span><span class="o">.</span><span class="n">aperture</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">collimation</span><span class="o">.</span><span class="n">aperture</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="o">==</span> <span class="n">aperture</span><span class="p">:</span>
+                    <span class="n">item</span> <span class="o">=</span> <span class="n">aperture</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">reset_aperture_combobox</span><span class="p">(</span><span class="n">edited_aperture</span><span class="o">=</span><span class="n">aperture</span><span class="p">)</span>
+                    <span class="k">return</span>
+                </div>
+<div class="viewcode-block" id="CollimationDialog.enable_aperture"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.enable_aperture">[docs]</a>    <span class="k">def</span> <span class="nf">enable_aperture</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Enable /disable widgets crelated to aperture</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">collimation</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_collimation</span><span class="p">()</span>
+        <span class="k">if</span>  <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit_aperture</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_aperture</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="n">n_aperture</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span>
+            <span class="n">aperture_hint_txt</span> <span class="o">=</span> <span class="s">&#39;apertures available: </span><span class="si">%s</span><span class="s"> &#39;</span><span class="o">%</span><span class="nb">str</span><span class="p">(</span><span class="n">n_aperture</span><span class="p">)</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">aperture</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_aperture</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_aperture</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit_aperture</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_aperture</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="n">aperture_hint_txt</span> <span class="o">=</span> <span class="s">&#39;No aperture is available for this data.&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_txt</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">aperture_hint_txt</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="CollimationDialog.reset_aperture_combobox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.reset_aperture_combobox">[docs]</a>    <span class="k">def</span> <span class="nf">reset_aperture_combobox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">edited_aperture</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        take all edited editor and reset clientdata of aperture combo box</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">position</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()):</span>
+            <span class="n">aperture</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">aperture</span> <span class="o">==</span> <span class="n">edited_aperture</span><span class="p">:</span>
+                <span class="n">aperture</span> <span class="o">=</span> <span class="n">edited_aperture</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">SetString</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">aperture</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+                <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">aperture</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">aperture</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+                </div>
+<div class="viewcode-block" id="CollimationDialog.fill_aperture_combox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.fill_aperture_combox">[docs]</a>    <span class="k">def</span> <span class="nf">fill_aperture_combox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill the current combobox with the available aperture</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="n">collimation</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_collimation</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">collimation</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">collimation</span><span class="o">.</span><span class="n">aperture</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">for</span> <span class="n">aperture</span> <span class="ow">in</span> <span class="n">collimation</span><span class="o">.</span><span class="n">aperture</span><span class="p">:</span>
+            <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">aperture</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">,</span> <span class="n">aperture</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">aperture_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">aperture</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+         </div>
+<div class="viewcode-block" id="CollimationDialog.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.set_manager">[docs]</a>    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;    </span>
+<span class="sd">        Set manager of this window</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        </div>
+<div class="viewcode-block" id="CollimationDialog.set_values"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.set_values">[docs]</a>    <span class="k">def</span> <span class="nf">set_values</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        take the collimation values of the current data and display them</span>
+<span class="sd">        through the panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">collimation</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_collimation</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">collimation</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_aperture</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">length_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">length_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+            <span class="k">return</span>
+        <span class="c">#Name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+        <span class="c">#length</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">length_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">length</span><span class="p">))</span>
+        <span class="c">#Length unit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">length_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">length_unit</span><span class="p">))</span>
+        </div>
+<div class="viewcode-block" id="CollimationDialog.get_collimation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.get_collimation">[docs]</a>    <span class="k">def</span> <span class="nf">get_collimation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the current collimation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span>
+    </div>
+<div class="viewcode-block" id="CollimationDialog.get_notes"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.get_notes">[docs]</a>    <span class="k">def</span> <span class="nf">get_notes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return notes</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span>
+    </div>
+<div class="viewcode-block" id="CollimationDialog.on_change_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.on_change_name">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">collimation</span><span class="p">,</span> <span class="n">collimation_name</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_collimation</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">collimation</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="k">return</span>
+        <span class="c">#Change the name of the collimation</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">name</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">collimation</span><span class="o">.</span><span class="n">name</span> <span class="o">!=</span> <span class="n">name</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change collimation &#39;s &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;name from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+            <span class="n">collimation</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetString</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">collimation</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">collimation_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+   </div>
+<div class="viewcode-block" id="CollimationDialog.on_change_length"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.on_change_length">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_length</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change the length</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">collimation</span><span class="p">,</span> <span class="n">collimation_name</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_collimation</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">collimation</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="k">return</span>
+        <span class="c">#Change length  </span>
+        <span class="n">length</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">length_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">length</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">length</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">length</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">collimation</span><span class="o">.</span><span class="n">length</span> <span class="o">=</span> <span class="n">length</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">length_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">collimation</span><span class="o">.</span><span class="n">length</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">length</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change Collimation length from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">length</span><span class="p">,</span> <span class="n">length</span><span class="p">)</span>
+                    <span class="n">collimation</span><span class="o">.</span><span class="n">length</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">length</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for collimation length&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; won&#39;t changes length from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">length</span><span class="p">,</span> <span class="n">length</span><span class="p">)</span>
+        <span class="c">#change length  unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">length_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">collimation</span><span class="o">.</span><span class="n">length_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change length&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">collimation</span><span class="o">.</span><span class="n">length_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            <span class="n">collimation</span><span class="o">.</span><span class="n">length_unit</span> <span class="o">=</span> <span class="n">unit</span>
+    </div>
+<div class="viewcode-block" id="CollimationDialog.on_click_apply"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.on_click_apply">[docs]</a>    <span class="k">def</span> <span class="nf">on_click_apply</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Apply user values to the collimation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_length</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">set_collimation</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span><span class="p">)</span>
+       </div>
+<div class="viewcode-block" id="CollimationDialog.on_click_cancel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.collimation_editor.CollimationDialog.on_click_cancel">[docs]</a>    <span class="k">def</span> <span class="nf">on_click_cancel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        leave the collimation as it is and close</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_reset_collimation</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">set_collimation</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_collimation</span><span class="p">)</span>
+       
+ </div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>
+
+    <span class="n">app</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">()</span>
+    <span class="n">dlg</span> <span class="o">=</span> <span class="n">CollimationDialog</span><span class="p">(</span><span class="n">collimation</span><span class="o">=</span><span class="p">[</span><span class="n">Collimation</span><span class="p">()])</span>
+    <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>
+ 
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/console.html
===================================================================
--- _modules/sas/perspectives/calculator/console.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/console.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,161 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.console &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.console</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Console Module display message of a dialog</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.loader</span> <span class="kn">import</span> <span class="n">Loader</span>
+
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">60</span>
+<span class="n">CONSOLE_WIDTH</span> <span class="o">=</span> <span class="mi">340</span>
+<span class="n">CONSOLE_HEIGHT</span> <span class="o">=</span> <span class="mi">240</span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">450</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">550</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">480</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">530</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">560</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    
+<div class="viewcode-block" id="ConsoleDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.console.ConsoleDialog">[docs]</a><span class="k">class</span> <span class="nc">ConsoleDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Data summary dialog</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                    <span class="n">title</span><span class="o">=</span><span class="s">&quot;Data Summary&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">)):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
+   
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">msg_txt</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="bp">self</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="o">-</span><span class="mi">40</span><span class="p">,</span>
+                                                <span class="n">PANEL_HEIGHT</span><span class="o">-</span><span class="mi">60</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_MULTILINE</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">msg_txt</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">msg_txt</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;No message available&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">msg_txt</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_message</span><span class="p">(</span><span class="n">msg</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">__str__</span><span class="p">())</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="ConsoleDialog.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.console.ConsoleDialog.set_manager">[docs]</a>    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the manager of this window</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="n">manager</span>
+        </div>
+<div class="viewcode-block" id="ConsoleDialog.set_message"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.console.ConsoleDialog.set_message">[docs]</a>    <span class="k">def</span> <span class="nf">set_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg</span><span class="o">=</span><span class="s">&quot;&quot;</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Display the message received </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">msg_txt</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">))</span>
+ </div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>
+   
+    <span class="n">app</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">()</span>
+    <span class="c"># Instantiate a loader </span>
+    <span class="n">loader</span> <span class="o">=</span> <span class="n">Loader</span><span class="p">()</span>
+    <span class="c"># Load data </span>
+    <span class="n">test_data</span> <span class="o">=</span> <span class="n">loader</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s">&quot;MAR07232_rest.ASC&quot;</span><span class="p">)</span>
+    <span class="n">dlg</span> <span class="o">=</span> <span class="n">ConsoleDialog</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">test_data</span><span class="p">)</span>
+    <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/data_editor.html
===================================================================
--- _modules/sas/perspectives/calculator/data_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/data_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,751 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.data_editor &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.data_editor</h1><div class="highlight"><pre>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">os</span> 
+<span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">deepcopy</span>
+
+<span class="kn">from</span> <span class="nn">sas.dataloader.loader</span> <span class="kn">import</span> <span class="n">Loader</span>
+<span class="c">#from DataLoader.data_info import DataInfo</span>
+<span class="c">#from DataLoader.data_info import  Detector</span>
+<span class="c">#from DataLoader.data_info import Collimation</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Data2D</span>
+<span class="kn">from</span> <span class="nn">detector_editor</span> <span class="kn">import</span> <span class="n">DetectorDialog</span>
+<span class="kn">from</span> <span class="nn">collimation_editor</span> <span class="kn">import</span> <span class="n">CollimationDialog</span>
+<span class="kn">from</span> <span class="nn">console</span> <span class="kn">import</span> <span class="n">ConsoleDialog</span>
+
+<span class="c">#from sas.guiframe.utils import check_float</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>
+
+
+<span class="n">_QMIN_DEFAULT</span> <span class="o">=</span> <span class="mf">0.001</span>
+<span class="n">_QMAX_DEFAULT</span> <span class="o">=</span> <span class="mf">0.13</span>
+<span class="n">_NPTS_DEFAULT</span> <span class="o">=</span> <span class="mi">50</span>
+<span class="c">#Control panel width </span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;darwin&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">PANEL_HEIGTH</span> <span class="o">=</span> <span class="mi">350</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+    <span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">51</span>
+    <span class="n">ON_MAC</span> <span class="o">=</span> <span class="bp">False</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">76</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">550</span>
+    <span class="n">PANEL_HEIGTH</span> <span class="o">=</span> <span class="mi">400</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    <span class="n">ON_MAC</span> <span class="o">=</span> <span class="bp">True</span>
+    
+<span class="k">def</span> <span class="nf">load_error</span><span class="p">(</span><span class="n">error</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+<div class="viewcode-block" id="load_error"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.load_error">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Pop up an error message.</span>
+<span class="sd">        </span>
+<span class="sd">        @param error: details error message to be displayed</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;You had to try this, didn&#39;t you?</span><span class="se">\n\n</span><span class="s">&quot;</span>
+    <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;The data file you selected could not be loaded.</span><span class="se">\n</span><span class="s">&quot;</span>
+    <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;Make sure the content of your file is properly formatted.</span><span class="se">\n\n</span><span class="s">&quot;</span>
+    
+    <span class="k">if</span> <span class="n">error</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;When contacting the DANSE team,&quot;</span>
+        <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot; mention the following:</span><span class="se">\n</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">error</span><span class="p">)</span>
+    
+    <span class="n">dial</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MessageDialog</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="n">message</span><span class="p">,</span> 
+                            <span class="s">&#39;Error Loading File&#39;</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">OK</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ICON_EXCLAMATION</span><span class="p">)</span>
+    <span class="n">dial</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> 
+    
+    
+<span class="k">class</span> <span class="nc">DataEditorPanel</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ScrolledWindow</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    :param data: when not empty the class can </span>
+<span class="sd">                same information into a dat object</span>
+<span class="sd">        and post event containing the changed data object to some other frame</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="p">[],</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;name&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Data Editor&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;size&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGTH</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">ScrolledWindow</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_data</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_description</span> <span class="o">=</span> <span class="s">&quot;Edit Data&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_panel</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">complete_loading</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+             
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        define initial sizer </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="n">name_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Load Data&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">name_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">title_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">run_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">instrument_sizer</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>
+        
+        <span class="n">edit_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Edit &quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">edit_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">edit_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+      
+    <span class="k">def</span> <span class="nf">_layout_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for data name related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#data name [string]</span>
+        <span class="n">data_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Data : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_select_data</span><span class="p">)</span> 
+        <span class="n">hint_data</span> <span class="o">=</span> <span class="s">&quot;Loaded data.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_data</span><span class="p">)</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">browse_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Browse&quot;</span><span class="p">)</span>
+        <span class="n">hint_on_browse</span> <span class="o">=</span> <span class="s">&quot;Click on this button to import data in this panel.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">browse_button</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_on_browse</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_browse</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">data_name_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">browse_button</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_title</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for data title related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#title name [string]</span>
+        <span class="n">data_title_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Title : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_title_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="o">*</span><span class="mi">3</span><span class="o">/</span><span class="mi">5</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_title_tcl</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="bp">self</span><span class="o">.</span><span class="n">on_change_title</span><span class="p">)</span>
+        <span class="n">hint_title</span> <span class="o">=</span> <span class="s">&quot;Data&#39;s title.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_title_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_title</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">title_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">data_title_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_title_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_run</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for data run related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data_run_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Run : &#39;</span><span class="p">)</span> 
+        <span class="n">data_run_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_run_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="o">*</span><span class="mi">3</span><span class="o">/</span><span class="mi">5</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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_MULTILINE</span><span class="p">)</span>
+        <span class="n">hint_run</span> <span class="o">=</span> <span class="s">&quot;Data&#39;s run.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_run_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_run</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">run_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">data_run_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_run_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_instrument</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for instrument related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">instrument_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Instrument : &#39;</span><span class="p">)</span> 
+        <span class="n">hint_instrument_txt</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="n">instrument_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_instrument_txt</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">instrument_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">5</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span> 
+        <span class="n">hint_instrument</span> <span class="o">=</span> <span class="s">&quot;Instrument.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">instrument_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_instrument</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">instrument_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">instrument_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">instrument_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_editor</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for sample related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_rb</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Detector&quot;</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">RB_GROUP</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_rb</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Sample&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_rb</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Source&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_rb</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Collimation&quot;</span><span class="p">)</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Edit&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Edit data.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_edit</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">edit_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">detector_rb</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sample_rb</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">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">source_rb</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">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">collimation_rb</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">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_edit</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">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_radiobox</span><span class="p">()</span>
+   
+    
+    <span class="k">def</span> <span class="nf">_layout_source</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for source related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">source_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Source &#39;</span><span class="p">)</span> 
+        <span class="n">hint_source_txt</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="n">source_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_source_txt</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit_source</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Edit&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit_source</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Edit data&#39;s sample.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit_source</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">edit_source</span><span class="p">)</span>
+        <span class="c">#self.source_sizer.AddMany([(source_txt, 0, wx.ALL, 10),</span>
+        <span class="c">#                        (self.bt_edit_source, 0,</span>
+        <span class="c">#                          wx.RIGHT|wx.BOTTOM|wx.TOP, 10)])</span>
+
+    <span class="k">def</span> <span class="nf">_layout_summary</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Layout widgets related to data&#39;s summary</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_summary</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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_MULTILINE</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">HSCROLL</span><span class="p">,</span>
+                                        <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">200</span><span class="p">))</span>
+        <span class="n">summary</span> <span class="o">=</span> <span class="s">&#39;No data info available...&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_summary</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">summary</span><span class="p">)</span>
+        <span class="c">#self.summary_sizer.Add(self.data_summary, 1, wx.EXPAND|wx.ALL, 10)  </span>
+                    
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_summary</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;View&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_summary</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;View final changes on data.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_summary</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_view</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_save</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Save As&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_save</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Save changes in a file.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_save</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_save</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Apply&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Save changes into the imported data.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_apply</span><span class="p">)</span>
+      
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_reset</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Reset&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_reset</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_reset</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_reset</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Reset data to its initial state.&quot;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Close&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close this panel.&quot;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_save</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">LEFT</span><span class="p">,</span> <span class="mi">120</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_reset</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_summary</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw the current panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_title</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_run</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_editor</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">title_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">run_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">instrument_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">edit_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span><span class="mi">10</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetScrollbars</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">65</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">fill_data_combox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="DataEditorPanel.fill_data_combox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.fill_data_combox">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill the current combobox with the available data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">data</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">title</span>
+            <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">run</span><span class="p">:</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">run</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">==</span><span class="s">&quot;&quot;</span><span class="p">:</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">filename</span>
+            <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">))</span> 
+       
+    <span class="k">def</span> <span class="nf">reset_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.reset_panel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.reset_panel">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_data_cbox</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_title_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_run_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">on_select_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.on_select_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.on_select_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_panel</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_title_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">title</span><span class="p">))</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">run</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">data</span><span class="o">.</span><span class="n">run</span><span class="p">:</span>
+                <span class="n">text</span> <span class="o">+=</span> <span class="n">item</span><span class="o">+</span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_run_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">text</span><span class="p">))</span>
+            
+    <span class="k">def</span> <span class="nf">get_current_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.get_current_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.get_current_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span> 
+        <span class="k">if</span> <span class="n">position</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">NOT_FOUND</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span>
+        <span class="n">data_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="o">.</span><span class="n">GetStringSelection</span><span class="p">()</span> 
+        <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">data</span><span class="p">,</span> <span class="n">data_name</span><span class="p">,</span> <span class="n">position</span>
+    
+    <span class="k">def</span> <span class="nf">enable_data_cbox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.enable_data_cbox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.enable_data_cbox">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_summary</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_reset</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_save</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_cbox</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_summary</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_reset</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_save</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_edit</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            
+    <span class="k">def</span> <span class="nf">reset_radiobox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.reset_radiobox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.reset_radiobox">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_rb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_rb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_rb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">collimation_rb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">set_sample</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sample</span><span class="p">,</span> <span class="n">notes</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.set_sample"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.set_sample">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set sample for data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="n">data</span><span class="o">.</span><span class="n">sample</span> <span class="o">=</span> <span class="n">sample</span>
+        <span class="k">if</span> <span class="n">notes</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">process</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">notes</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">set_source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="n">notes</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.set_source"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.set_source">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set source for data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">data_name</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="n">data</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">source</span>
+        <span class="k">if</span> <span class="n">notes</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">process</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">notes</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">set_detector</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">detector</span><span class="p">,</span> <span class="n">notes</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.set_detector"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.set_detector">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set detector for data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">data_name</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="n">data</span><span class="o">.</span><span class="n">detector</span> <span class="o">=</span> <span class="n">detector</span>
+        <span class="k">if</span> <span class="n">notes</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">process</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">notes</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">set_collimation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">collimation</span><span class="p">,</span> <span class="n">notes</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.set_collimation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.set_collimation">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set collimation for data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">data_name</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="n">data</span><span class="o">.</span><span class="n">collimation</span> <span class="o">=</span> <span class="n">collimation</span>
+        <span class="k">if</span> <span class="n">notes</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">process</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">notes</span><span class="p">)</span>
+                
+    <span class="k">def</span> <span class="nf">edit_collimation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.edit_collimation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.edit_collimation">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Edit the selected collimation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">data_name</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="n">dlg</span> <span class="o">=</span> <span class="n">CollimationDialog</span><span class="p">(</span><span class="n">collimation</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">collimation</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+            
+    <span class="k">def</span> <span class="nf">edit_detector</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.edit_detector"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.edit_detector">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Edit the selected detector</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">data_name</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="n">dlg</span> <span class="o">=</span> <span class="n">DetectorDialog</span><span class="p">(</span><span class="n">detector</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+
+    <span class="k">def</span> <span class="nf">edit_sample</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.edit_sample"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.edit_sample">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Open the dialog to edit the sample of the current data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="kn">from</span> <span class="nn">sample_editor</span> <span class="kn">import</span> <span class="n">SampleDialog</span>
+        <span class="n">dlg</span> <span class="o">=</span> <span class="n">SampleDialog</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">sample</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">sample</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">edit_source</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.edit_source"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.edit_source">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Open the dialog to edit the saource of the current data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">data_name</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="kn">from</span> <span class="nn">source_editor</span> <span class="kn">import</span> <span class="n">SourceDialog</span>
+        <span class="n">dlg</span> <span class="o">=</span> <span class="n">SourceDialog</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">choose_data_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.choose_data_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.choose_data_file">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Open a file dialog to allow loading a file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">location</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>
+        
+        <span class="n">l</span> <span class="o">=</span> <span class="n">Loader</span><span class="p">()</span>
+        <span class="n">cards</span> <span class="o">=</span> <span class="n">l</span><span class="o">.</span><span class="n">get_wildcards</span><span class="p">()</span>
+        <span class="n">wlist</span> <span class="o">=</span> <span class="s">&#39;|&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">cards</span><span class="p">)</span>
+        
+        <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="bp">self</span><span class="p">,</span> <span class="s">&quot;Choose a file&quot;</span><span class="p">,</span> <span class="n">location</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">,</span> <span class="n">wlist</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">OPEN</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+            <span class="n">mypath</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">path</span>
+    
+    
+    <span class="k">def</span> <span class="nf">complete_loading</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.complete_loading"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.complete_loading">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Complete the loading and compute the slit size</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">done</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Couldn&#39;t load data&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                             <span class="n">info</span><span class="o">=</span><span class="s">&quot;warning&quot;</span><span class="p">,</span><span class="nb">type</span><span class="o">=</span><span class="s">&#39;stop&#39;</span><span class="p">))</span>
+            <span class="k">return</span> 
+        <span class="k">if</span> <span class="ow">not</span>  <span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;list&quot;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_reset_data</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">data</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_reset_data</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Load Complete&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span><span class="nb">type</span><span class="o">=</span><span class="s">&#39;stop&#39;</span><span class="p">))</span>
+  
+    <span class="k">def</span> <span class="nf">set_values</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.set_values"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.set_values">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        take the aperture values of the current data and display them</span>
+<span class="sd">        through the panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fill_data_combox</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">on_select_data</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.get_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the current data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span>
+    
+    <span class="k">def</span> <span class="nf">get_notes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.get_notes"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.get_notes">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return notes</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span>
+    
+    <span class="k">def</span> <span class="nf">on_change_run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.on_change_run"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.on_change_run">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change run</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">run</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_run_tcl</span><span class="o">.</span><span class="n">GetNumberOfLines</span><span class="p">()):</span>
+            <span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_run_tcl</span><span class="o">.</span><span class="n">GetLineText</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">text</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                <span class="n">run</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">run</span> <span class="o">!=</span> <span class="n">run</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change data &#39;s &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;run from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">run</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">run</span><span class="p">))</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">run</span> <span class="o">=</span> <span class="n">run</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+                 
+    <span class="k">def</span> <span class="nf">on_change_title</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.on_change_title"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.on_change_title">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change title</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="c">#Change data&#39;s name</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_title_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        
+        <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">title</span> <span class="o">!=</span> <span class="n">title</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change data &#39;s &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;title from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">title</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">title</span><span class="p">))</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            
+    <span class="k">def</span> <span class="nf">on_click_browse</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.on_click_browse"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.on_click_browse">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Open a file dialog to allow the user to select a given file.</span>
+<span class="sd">        Display the loaded data if available.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">choose_data_file</span><span class="p">(</span><span class="n">location</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">path</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Loading...&quot;</span><span class="p">,</span>
+                                        <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;progress&quot;</span><span class="p">))</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">done</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">path</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c">#Load data</span>
+            <span class="kn">from</span> <span class="nn">load_thread</span> <span class="kn">import</span> <span class="n">DataReader</span>
+            <span class="c">## If a thread is already started, stop it</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="n">DataReader</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="n">path</span><span class="p">,</span>
+                                    <span class="n">completefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">complete_loading</span><span class="p">,</span>
+                                    <span class="n">updatefn</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Data Editor: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+            <span class="n">load_error</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+            <span class="k">return</span> 
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+         
+    <span class="k">def</span> <span class="nf">on_edit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.on_edit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.on_edit">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_rb</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">edit_detector</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sample_rb</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">edit_sample</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">source_rb</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">edit_source</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">collimation_rb</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">edit_collimation</span><span class="p">()</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            
+    <span class="k">def</span> <span class="nf">on_click_apply</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.on_click_apply"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.on_click_apply">[docs]</a>        <span class="sd">&quot;&quot;&quot;   </span>
+<span class="sd">        changes are saved in data object imported to edit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_run</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_title</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="c">#must post event here</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">on_click_save</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.on_click_save"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.on_click_save">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Save change into a file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_run</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_title</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">wildcard</span> <span class="o">=</span> <span class="s">&quot;CanSAS 1D files(*.xml)|*.xml&quot;</span> 
+        <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="bp">self</span><span class="p">,</span> <span class="s">&quot;Choose a file&quot;</span><span class="p">,</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">,</span><span class="n">wildcard</span> <span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">SAVE</span><span class="p">)</span>
+       
+        <span class="k">for</span> <span class="n">data</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data2D</span><span class="p">):</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;No conventional writing format for </span><span class="se">\n\n</span><span class="s">&quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Data2D at this time.</span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">dlg</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MessageDialog</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Error Loading File&#39;</span><span class="p">,</span>
+                                             <span class="n">wx</span><span class="o">.</span><span class="n">OK</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ICON_EXCLAMATION</span><span class="p">)</span>
+                <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>   
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+                    <span class="n">path</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+                    <span class="n">mypath</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+                    <span class="n">loader</span> <span class="o">=</span> <span class="n">Loader</span><span class="p">()</span> 
+                    <span class="n">format</span> <span class="o">=</span> <span class="s">&quot;.xml&quot;</span>
+                    <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">mypath</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="n">format</span><span class="p">:</span>
+                        <span class="n">loader</span><span class="o">.</span><span class="n">save</span><span class="p">(</span> <span class="n">path</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">format</span><span class="p">)</span>
+                    <span class="k">try</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+                    <span class="k">except</span><span class="p">:</span>
+                        <span class="k">pass</span>    
+                    <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">on_click_view</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.on_click_view"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.on_click_view">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Display data info </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">data_name</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_run</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_title</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="n">dlg</span> <span class="o">=</span> <span class="n">ConsoleDialog</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+    
+    <span class="k">def</span> <span class="nf">on_click_reset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.on_click_reset"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.on_click_reset">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span><span class="p">,</span> <span class="n">data_name</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_data</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">[</span><span class="n">position</span><span class="p">]</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_reset_data</span><span class="p">[</span><span class="n">position</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataEditorPanel.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorPanel.on_close">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        leave data as it is and close</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">Close</span><span class="p">()</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        
+<span class="k">class</span> <span class="nc">DataEditorWindow</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="p">):</span></div></div>
+<div class="viewcode-block" id="DataEditorWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorWindow">[docs]</a>    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;size&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGTH</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">DataEditorPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="DataEditorWindow.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_editor.DataEditorWindow.get_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            return the current data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+    
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div></div>
+   
+    <span class="n">app</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">()</span>
+    <span class="n">window</span> <span class="o">=</span> <span class="n">DataEditorWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="p">[],</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Data Editor&quot;</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>
+ 
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/data_operator.html
===================================================================
--- _modules/sas/perspectives/calculator/data_operator.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/data_operator.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,1052 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.data_operator &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.data_operator</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">GUI for the data operation</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">import</span> <span class="nn">numpy</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Data1D</span>
+<span class="kn">from</span> <span class="nn">sas.plottools.PlotPanel</span> <span class="kn">import</span> <span class="n">PlotPanel</span>
+<span class="kn">from</span> <span class="nn">sas.plottools.plottables</span> <span class="kn">import</span> <span class="n">Graph</span>
+<span class="kn">from</span> <span class="nn">sas.plottools</span> <span class="kn">import</span> <span class="n">transform</span>
+<span class="kn">from</span> <span class="nn">matplotlib.font_manager</span> <span class="kn">import</span> <span class="n">FontProperties</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span> 
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator</span> <span class="kn">import</span> <span class="n">calculator_widgets</span> <span class="k">as</span> <span class="n">widget</span>   
+<span class="c">#Control panel width </span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">790</span>
+    <span class="n">PANEL_HEIGTH</span> <span class="o">=</span> <span class="mi">370</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+    <span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">200</span>
+    <span class="n">ON_MAC</span> <span class="o">=</span> <span class="bp">False</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">230</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">900</span>
+    <span class="n">PANEL_HEIGTH</span> <span class="o">=</span> <span class="mi">430</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    <span class="n">ON_MAC</span> <span class="o">=</span> <span class="bp">True</span>
+      
+<div class="viewcode-block" id="DataOperPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel">[docs]</a><span class="k">class</span> <span class="nc">DataOperPanel</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ScrolledWindow</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;name&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Data Operation&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;size&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGTH</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">ScrolledWindow</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="c">#sizers etc.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_title_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">out_pic</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">equal_pic</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data1_pic</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator_pic</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data2_pic</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#text grayed color</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">color</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">SystemSettings</span><span class="o">.</span><span class="n">GetColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">SYS_COLOUR_BACKGROUND</span><span class="p">)</span>
+        <span class="c">#data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_datalist</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_data_combox</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_oprator_combox</span><span class="p">()</span>
+        <span class="bp">self</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_PAINT</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_panel_on_focus</span><span class="p">)</span>
+             
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        define initial sizer </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="n">title</span> <span class="o">=</span> <span class="s">&quot;Data Operation &quot;</span>
+        <span class="n">title</span> <span class="o">+=</span> <span class="s">&quot;[ + (add); - (subtract); &quot;</span>
+        <span class="n">title</span> <span class="o">+=</span> <span class="s">&quot;* (multiply); / (divide); &quot;</span>
+        <span class="n">title</span> <span class="o">+=</span> <span class="s">&quot;| (append) ]&quot;</span>
+        <span class="n">name_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">title</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">name_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+      
+    <span class="k">def</span> <span class="nf">_layout_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for data name related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">new_data_sizer</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>
+        <span class="n">equal_sizer</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>
+        <span class="n">old_data1_sizer</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>
+        <span class="n">operator_sizer</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>
+        <span class="n">old_data2_sizer</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>
+        <span class="n">data2_hori_sizer</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>
+        <span class="n">data_name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Output Data Name&#39;</span><span class="p">)</span>  
+        <span class="n">equal_name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39; =&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="mi">25</span><span class="p">))</span> 
+        <span class="n">data1_name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Data1&#39;</span><span class="p">)</span>
+        <span class="n">operator_name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Operator&#39;</span><span class="p">)</span>
+        <span class="n">data2_name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Data2 (or Number)&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">25</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Hit &#39;Enter&#39; key after typing.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="s">&#39;MyNewDataName&#39;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">numberctr</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="mi">25</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Hit &#39;Enter&#39; key after typing.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="mf">1.0</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">25</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">70</span><span class="p">,</span> <span class="mi">25</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>
+        <span class="n">operation_tip</span> <span class="o">=</span> <span class="s">&quot;Add: +, Subtract: -, &quot;</span>
+        <span class="n">operation_tip</span> <span class="o">+=</span> <span class="s">&quot;Multiply: *, Divide: /, &quot;</span>
+        <span class="n">operation_tip</span> <span class="o">+=</span> <span class="s">&quot;Append(Combine): | &quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">operation_tip</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">2</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="mi">25</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>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">out_pic</span> <span class="o">=</span> <span class="n">SmallPanel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">True</span><span class="p">,</span> 
+                                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="n">_BOX_WIDTH</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">NO_BORDER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">equal_pic</span> <span class="o">=</span> <span class="n">SmallPanel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">True</span><span class="p">,</span> <span class="s">&#39;=&#39;</span><span class="p">,</span>  
+                                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="n">_BOX_WIDTH</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">NO_BORDER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data1_pic</span> <span class="o">=</span> <span class="n">SmallPanel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">True</span><span class="p">,</span> 
+                                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="n">_BOX_WIDTH</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">NO_BORDER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator_pic</span> <span class="o">=</span> <span class="n">SmallPanel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">True</span><span class="p">,</span> <span class="s">&#39;+&#39;</span><span class="p">,</span>
+                                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">70</span><span class="p">,</span> <span class="n">_BOX_WIDTH</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">NO_BORDER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data2_pic</span> <span class="o">=</span> <span class="n">SmallPanel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">True</span><span class="p">,</span> 
+                                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="n">_BOX_WIDTH</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">NO_BORDER</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">ax</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">equal_pic</span><span class="o">.</span><span class="n">axes</span><span class="p">:</span>
+            <span class="n">ax</span><span class="o">.</span><span class="n">set_frame_on</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">ax</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator_pic</span><span class="o">.</span><span class="n">axes</span><span class="p">:</span>
+            <span class="n">ax</span><span class="o">.</span><span class="n">set_frame_on</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+
+        <span class="n">new_data_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">data_name</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</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">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">out_pic</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">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">)])</span>
+        <span class="n">equal_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="mi">13</span><span class="p">,</span> <span class="mi">13</span><span class="p">),</span> <span class="p">(</span><span class="n">equal_name</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">equal_pic</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">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">)])</span>
+        <span class="n">old_data1_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">data1_name</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</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">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data1_pic</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">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">)])</span>
+        <span class="n">operator_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">operator_name</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</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">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">operator_pic</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">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">)])</span>
+        <span class="n">data2_hori_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</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">LEFT</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</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">RIGHT</span><span class="p">,</span> <span class="mi">0</span><span class="p">)])</span>
+        <span class="n">old_data2_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">data2_name</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="n">data2_hori_sizer</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">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data2_pic</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">LEFT</span><span class="p">,</span> <span class="mi">3</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">new_data_sizer</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="n">equal_sizer</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">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="n">old_data1_sizer</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">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="n">operator_sizer</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">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="n">old_data2_sizer</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">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">_show_numctrl</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="bp">False</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="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_name</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="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_number</span><span class="p">)</span> 
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_select_data1</span><span class="p">)</span> 
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_select_operator</span><span class="p">)</span> 
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_select_data2</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_show_numctrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ctrl</span><span class="p">,</span> <span class="n">enable</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show/Hide on Win</span>
+<span class="sd">        Enable/Disable on MAC</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">ON_MAC</span><span class="p">:</span>
+            <span class="n">ctrl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="n">enable</span><span class="p">)</span>
+            <span class="n">children</span> <span class="o">=</span> <span class="n">ctrl</span><span class="o">.</span><span class="n">GetChildren</span><span class="p">()</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">children</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">ctrl</span><span class="o">.</span><span class="n">GetChildren</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackGroundColour</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">color</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">enable</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="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_number</span><span class="p">)</span> 
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">ctrl</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+                <span class="n">ctrl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">ctrl</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="n">enable</span><span class="p">)</span>
+            
+<div class="viewcode-block" id="DataOperPanel.on_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.on_name">[docs]</a>    <span class="k">def</span> <span class="nf">on_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On data name typing</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="s">&#39;white&#39;</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">color</span><span class="p">)</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_check_newname</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_check_newname</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check name ctr strings</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">text</span> <span class="o">=</span> <span class="n">name</span>
+        <span class="n">state_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_datalist</span><span class="p">()</span><span class="o">.</span><span class="n">values</span><span class="p">()</span>
+        <span class="n">name_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">state</span> <span class="ow">in</span> <span class="n">state_list</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">theory_list</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">get_theory</span><span class="p">()</span>
+                <span class="n">theory</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">theory_list</span><span class="o">.</span><span class="n">values</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="n">d_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">theory</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">d_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+            <span class="n">name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">d_name</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">text</span> <span class="ow">in</span> <span class="n">name_list</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;DataOperation: The name already exists.&quot;</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">text</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;DataOperation: Type the data name first.&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;error&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+    
+    <span class="k">def</span> <span class="nf">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ctrl</span><span class="p">,</span> <span class="n">color</span><span class="p">):</span> 
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set TextCtrl color </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">ON_MAC</span><span class="p">:</span>
+            <span class="n">children</span> <span class="o">=</span> <span class="n">ctrl</span><span class="o">.</span><span class="n">GetChildren</span><span class="p">()</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">children</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">children</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">color</span><span class="p">)</span>  
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">ctrl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">color</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+                     
+<div class="viewcode-block" id="DataOperPanel.on_number"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.on_number">[docs]</a>    <span class="k">def</span> <span class="nf">on_number</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On selecting Number for Data2</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="s">&#39;white&#39;</span><span class="p">)</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
+                    <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;DataOperation: Number requires a float number.&quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;error&#39;</span><span class="p">)</span>
+                    <span class="k">return</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">color</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">put_text_pic</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data2_pic</span><span class="p">,</span> <span class="n">content</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">val</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">check_data_inputs</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_output</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="DataOperPanel.on_select_data1"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.on_select_data1">[docs]</a>    <span class="k">def</span> <span class="nf">on_select_data1</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On select data1</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">content</span> <span class="o">=</span> <span class="s">&quot;?&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_text_pic</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data1_pic</span><span class="p">,</span> <span class="n">content</span><span class="p">)</span> 
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data1_pic</span><span class="o">.</span><span class="n">add_image</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">check_data_inputs</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_output</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="DataOperPanel.on_select_operator"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.on_select_operator">[docs]</a>    <span class="k">def</span> <span class="nf">on_select_operator</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Select an Operator</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">put_text_pic</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">operator_pic</span><span class="p">,</span> <span class="n">content</span><span class="o">=</span><span class="n">text</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">check_data_inputs</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_output</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="DataOperPanel.on_select_data2"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.on_select_data2">[docs]</a>    <span class="k">def</span> <span class="nf">on_select_data2</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Selecting Data2</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_show_numctrl</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="n">text</span><span class="o">==</span><span class="s">&#39;number&#39;</span><span class="p">)</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="s">&quot;?&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">IsShown</span><span class="p">()</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">()):</span>
+            <span class="k">if</span> <span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">content</span> <span class="o">=</span> <span class="s">&quot;?&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">put_text_pic</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data2_pic</span><span class="p">,</span> <span class="n">content</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">data2_pic</span><span class="o">.</span><span class="n">add_image</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">check_data_inputs</span><span class="p">()</span> 
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">content</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">content</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">content</span><span class="p">)</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">content</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+                <span class="n">content</span> <span class="o">=</span> <span class="s">&quot;?&quot;</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">item</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">data</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">check_data_inputs</span><span class="p">()</span>
+                
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_text_pic</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data2_pic</span><span class="p">,</span> <span class="n">content</span><span class="p">)</span>   
+        
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_output</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="DataOperPanel.put_text_pic"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.put_text_pic">[docs]</a>    <span class="k">def</span> <span class="nf">put_text_pic</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pic</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">content</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Put text to the pic</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">pic</span><span class="o">.</span><span class="n">set_content</span><span class="p">(</span><span class="n">content</span><span class="p">)</span> 
+        <span class="n">pic</span><span class="o">.</span><span class="n">add_text</span><span class="p">()</span>
+        <span class="n">pic</span><span class="o">.</span><span class="n">draw</span><span class="p">()</span>
+                  </div>
+<div class="viewcode-block" id="DataOperPanel.check_data_inputs"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.check_data_inputs">[docs]</a>    <span class="k">def</span> <span class="nf">check_data_inputs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check data1 and data2 whether or not they are ready for operation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="p">,</span> <span class="s">&#39;white&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="p">,</span> <span class="s">&#39;white&#39;</span><span class="p">)</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">pos1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="n">data1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">pos1</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">data1</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">return</span> <span class="n">flag</span>
+        <span class="n">pos2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="n">data2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">pos2</span><span class="p">)</span>
+        
+        <span class="k">if</span> <span class="n">data2</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">return</span> <span class="n">flag</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="s">&#39;white&#39;</span><span class="p">)</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="nb">float</span><span class="p">(</span><span class="n">data2</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;|&#39;</span><span class="p">:</span>
+                        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;DataOperation: This operation can not accept &quot;</span>
+                        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;a float number.&quot;</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;error&#39;</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">=</span> <span class="bp">None</span>
+                        <span class="k">return</span> <span class="n">flag</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;DataOperation: Number requires a float number.&quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;error&#39;</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">=</span> <span class="bp">None</span>
+                    <span class="k">return</span> <span class="n">flag</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">color</span> <span class="p">)</span>
+        <span class="k">elif</span> <span class="n">data1</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="n">data2</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;DataOperation: Data types must be same.&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;error&#39;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">return</span> <span class="n">flag</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">make_data_out</span><span class="p">(</span><span class="n">data1</span><span class="p">,</span> <span class="n">data2</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_check_newname</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;DataOperation: Data types must be same.&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;error&#39;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">return</span> <span class="n">flag</span>
+        <span class="k">return</span> <span class="bp">True</span>
+    </div>
+<div class="viewcode-block" id="DataOperPanel.make_data_out"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.make_data_out">[docs]</a>    <span class="k">def</span> <span class="nf">make_data_out</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data1</span><span class="p">,</span> <span class="n">data2</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Make a temp. data output set</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">output</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="n">operator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">exec</span> <span class="s">&quot;output = data1 </span><span class="si">%s</span><span class="s"> data2&quot;</span><span class="o">%</span> <span class="n">operator</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">raise</span>
+        <span class="k">return</span> <span class="n">output</span>
+    
+    </div>
+<div class="viewcode-block" id="DataOperPanel.draw_output"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.draw_output">[docs]</a>    <span class="k">def</span> <span class="nf">draw_output</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">output</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw output data(temp)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">out</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">out_pic</span>
+        <span class="k">if</span> <span class="n">output</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">content</span> <span class="o">=</span> <span class="s">&quot;?&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_text_pic</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">content</span><span class="p">)</span> 
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">out</span><span class="o">.</span><span class="n">add_image</span><span class="p">(</span><span class="n">output</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">Layout</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                    </div>
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Apply&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">app_tip</span> <span class="o">=</span> <span class="s">&quot;Generate the Data and send to Data Explorer.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">app_tip</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_apply</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Close&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close this panel.&quot;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">PANEL_WIDTH</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="mi">25</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw the current panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetScrollbars</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">65</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="DataOperPanel.set_panel_on_focus"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.set_panel_on_focus">[docs]</a>    <span class="k">def</span> <span class="nf">set_panel_on_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Focus at this window</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_datalist</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">ON_MAC</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fill_data_combox</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">children</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetChildren</span><span class="p">()</span>
+            <span class="c"># update the list only when it is on the top</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">FindFocus</span><span class="p">()</span> <span class="ow">in</span> <span class="n">children</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fill_data_combox</span><span class="p">()</span>
+         </div>
+<div class="viewcode-block" id="DataOperPanel.fill_oprator_combox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.fill_oprator_combox">[docs]</a>    <span class="k">def</span> <span class="nf">fill_oprator_combox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill the current combobox with the operator</span>
+<span class="sd">        &quot;&quot;&quot;</span>   
+        <span class="n">operator_list</span> <span class="o">=</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> <span class="s">&#39; *&#39;</span><span class="p">,</span> <span class="s">&quot; /&quot;</span><span class="p">,</span> <span class="s">&quot; |&quot;</span><span class="p">]</span>
+        <span class="k">for</span> <span class="n">oper</span> <span class="ow">in</span> <span class="n">operator_list</span><span class="p">:</span>
+            <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">oper</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">oper</span><span class="o">.</span><span class="n">strip</span><span class="p">()))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        
+        </div>
+<div class="viewcode-block" id="DataOperPanel.fill_data_combox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.fill_data_combox">[docs]</a>    <span class="k">def</span> <span class="nf">fill_data_combox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill the current combobox with the available data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">pos_pre1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="n">pos_pre2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="n">current1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+        <span class="n">current2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">pos_pre1</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">pos_pre1</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">if</span> <span class="n">pos_pre2</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">pos_pre2</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">:</span>
+            <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;No Data Available&#39;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+            <span class="n">pos2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;No Data Available&#39;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos2</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos2</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+            <span class="k">return</span>
+        <span class="n">pos1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;Select Data&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos1</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+        <span class="n">pos2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;Select Data&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos2</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos2</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+        <span class="n">pos3</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;Number&#39;</span><span class="p">)</span>
+        <span class="n">val</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">IsShown</span><span class="p">()</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">()):</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">numberctr</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">val</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos3</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span>
+        <span class="n">dnames</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">ids</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
+        <span class="k">for</span> <span class="nb">id</span> <span class="ow">in</span> <span class="n">ids</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">id</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">data</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">dnames</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">theory_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">get_theory</span><span class="p">()</span>
+                    <span class="n">theory</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">theory_list</span><span class="o">.</span><span class="n">values</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
+                    <span class="n">dnames</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">theory</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+        <span class="n">ind</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">argsort</span><span class="p">(</span><span class="n">dnames</span><span class="p">)</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">ind</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">val_list</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">values</span><span class="p">())[</span><span class="n">ind</span><span class="p">]</span>
+            <span class="k">for</span> <span class="n">datastate</span> <span class="ow">in</span> <span class="n">val_list</span><span class="p">:</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">datastate</span><span class="o">.</span><span class="n">data</span>
+                <span class="k">if</span> <span class="n">data</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">name</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">name</span>
+                    <span class="n">pos1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">))</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos1</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
+                    <span class="n">pos2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">))</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos2</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">current1</span><span class="p">)</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
+                      <span class="n">pos_pre1</span> <span class="o">=</span> <span class="n">pos1</span> 
+                    <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">current2</span><span class="p">)</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
+                      <span class="n">pos_pre2</span> <span class="o">=</span> <span class="n">pos2</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">theory_list</span> <span class="o">=</span> <span class="n">datastate</span><span class="o">.</span><span class="n">get_theory</span><span class="p">()</span>
+                    <span class="k">for</span> <span class="n">theory</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">theory_list</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
+                        <span class="n">th_name</span> <span class="o">=</span> <span class="n">theory</span><span class="o">.</span><span class="n">name</span>
+                        <span class="n">posth1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">th_name</span><span class="p">))</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">posth1</span><span class="p">,</span> <span class="n">theory</span><span class="p">)</span>
+                        <span class="n">posth2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">th_name</span><span class="p">))</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">posth2</span><span class="p">,</span> <span class="n">theory</span><span class="p">)</span>
+                        <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">current1</span><span class="p">)</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="n">th_name</span><span class="p">):</span>
+                            <span class="n">pos_pre1</span> <span class="o">=</span> <span class="n">posth1</span>
+                        <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">current2</span><span class="p">)</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="n">th_name</span><span class="p">):</span>
+                            <span class="n">pos_pre2</span> <span class="o">=</span> <span class="n">posth2</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">continue</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">data1_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos_pre1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data2_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos_pre2</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="DataOperPanel.get_datalist"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.get_datalist">[docs]</a>    <span class="k">def</span> <span class="nf">get_datalist</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data_manager</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_data_manager</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data_manager</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>  <span class="n">data_manager</span><span class="o">.</span><span class="n">get_all_data</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="p">{}</span>
+            </div>
+<div class="viewcode-block" id="DataOperPanel.on_click_apply"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.on_click_apply">[docs]</a>    <span class="k">def</span> <span class="nf">on_click_apply</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;   </span>
+<span class="sd">        changes are saved in data object imported to edit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">send_warnings</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;white&#39;</span><span class="p">)</span>
+        <span class="n">state_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_datalist</span><span class="p">()</span><span class="o">.</span><span class="n">values</span><span class="p">()</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+        <span class="n">name_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">state</span> <span class="ow">in</span> <span class="n">state_list</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">theory_list</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">get_theory</span><span class="p">()</span>
+                <span class="n">theory</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">theory_list</span><span class="o">.</span><span class="n">values</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="n">d_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">theory</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">d_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+            <span class="n">name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">d_name</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">name_list</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;The Output Data Name already exists...   &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Error&#39;</span><span class="p">)</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_textctrl_color</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_namectr</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please type the output data name first...   &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Error&#39;</span><span class="p">)</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">output</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;No Output Data has been generated...   &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Error&#39;</span><span class="p">)</span>
+            <span class="k">return</span>
+        <span class="c"># send data to data manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="o">.</span><span class="n">run</span> <span class="o">=</span> <span class="s">&quot;Data Operation&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="o">.</span><span class="n">instrument</span> <span class="o">=</span> <span class="s">&quot;SasView&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">())</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="p">{</span><span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="o">.</span><span class="n">id</span> <span class="p">:</span><span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="p">}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="c">#must post event here</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="DataOperPanel.disconnect_panels"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.disconnect_panels">[docs]</a>    <span class="k">def</span> <span class="nf">disconnect_panels</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">out_pic</span><span class="o">.</span><span class="n">connect</span><span class="o">.</span><span class="n">disconnect</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">equal_pic</span><span class="o">.</span><span class="n">connect</span><span class="o">.</span><span class="n">disconnect</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data1_pic</span><span class="o">.</span><span class="n">connect</span><span class="o">.</span><span class="n">disconnect</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator_pic</span><span class="o">.</span><span class="n">connect</span><span class="o">.</span><span class="n">disconnect</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data2_pic</span><span class="o">.</span><span class="n">connect</span><span class="o">.</span><span class="n">disconnect</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="DataOperPanel.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        leave data as it is and close</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">OnClose</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="DataOperPanel.set_plot_unfocus"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.set_plot_unfocus">[docs]</a>    <span class="k">def</span> <span class="nf">set_plot_unfocus</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Unfocus on right click</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+    </div>
+<div class="viewcode-block" id="DataOperPanel.send_warnings"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperPanel.send_warnings">[docs]</a>    <span class="k">def</span> <span class="nf">send_warnings</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;info&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Send warning to status bar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="n">info</span><span class="p">))</span>
+          </div></div>
+<div class="viewcode-block" id="SmallPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel">[docs]</a><span class="k">class</span> <span class="nc">SmallPanel</span><span class="p">(</span><span class="n">PlotPanel</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    PlotPanel for Quick plot and masking plot</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">is_number</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">content</span><span class="o">=</span><span class="s">&#39;?&#39;</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="n">PlotPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_number</span> <span class="o">=</span> <span class="n">is_number</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">content</span> <span class="o">=</span> <span class="n">content</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">point</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">position</span> <span class="o">=</span> <span class="p">(</span><span class="mf">0.4</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">scale</span> <span class="o">=</span> <span class="s">&#39;linear&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">prevXtrans</span> <span class="o">=</span> <span class="s">&quot;x&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">prevYtrans</span> <span class="o">=</span> <span class="s">&quot;y&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">viewModel</span> <span class="o">=</span> <span class="s">&quot;--&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">set_xticks</span><span class="p">([])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">set_yticks</span><span class="p">([])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">add_text</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">subplots_adjust</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> <span class="n">bottom</span><span class="o">=</span><span class="mf">0.1</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="SmallPanel.set_content"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.set_content">[docs]</a>    <span class="k">def</span> <span class="nf">set_content</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">content</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set text content</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">content</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">content</span><span class="p">)</span>
+         </div>
+<div class="viewcode-block" id="SmallPanel.add_toolbar"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.add_toolbar">[docs]</a>    <span class="k">def</span> <span class="nf">add_toolbar</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Add toolbar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Not implemented</span>
+        <span class="k">pass</span>
+    </div>
+<div class="viewcode-block" id="SmallPanel.on_set_focus"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.on_set_focus">[docs]</a>    <span class="k">def</span> <span class="nf">on_set_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        send to the parenet the current panel on focus</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">pass</span>
+</div>
+<div class="viewcode-block" id="SmallPanel.add_image"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.add_image">[docs]</a>    <span class="k">def</span> <span class="nf">add_image</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">plot</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Add Image</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">content</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">textList</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plots</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">point</span> <span class="o">=</span> <span class="n">plot</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">delaxes</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">axes</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">111</span><span class="p">)</span>
+            <span class="c">#self.figure.delaxes(self.figure.axes[1])</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">plot</span><span class="o">.</span><span class="n">name</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">plot</span><span class="o">.</span><span class="n">filename</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plots</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">plot</span>
+
+        <span class="c">#init graph</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph</span> <span class="o">=</span> <span class="n">Graph</span><span class="p">()</span>
+
+        <span class="c">#add plot</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">plot</span><span class="p">)</span>
+        <span class="c">#draw        </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">delaxes</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">axes</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">canvas</span><span class="o">.</span><span class="n">resizing</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">tick_params</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="s">&#39;both&#39;</span><span class="p">,</span> <span class="n">labelsize</span><span class="o">=</span><span class="mi">9</span><span class="p">)</span>
+        <span class="c"># Draw zero axis lines</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">axhline</span><span class="p">(</span><span class="n">linewidth</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">&#39;r&#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">axvline</span><span class="p">(</span><span class="n">linewidth</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">&#39;r&#39;</span><span class="p">)</span>       
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">erase_legend</span><span class="p">()</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># mpl &gt;= 1.1.0</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">tight_layout</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">subplots_adjust</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> <span class="n">bottom</span><span class="o">=</span><span class="mf">0.1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">canvas</span><span class="o">.</span><span class="n">draw</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="SmallPanel.add_text"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.add_text">[docs]</a>    <span class="k">def</span> <span class="nf">add_text</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Text in the plot</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_number</span><span class="p">:</span>
+            <span class="k">return</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">delaxes</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">axes</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">111</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">delaxes</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">axes</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">set_xticks</span><span class="p">([])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">set_yticks</span><span class="p">([])</span>
+        <span class="n">label</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">content</span>
+        <span class="n">FONT</span> <span class="o">=</span> <span class="n">FontProperties</span><span class="p">()</span>
+        <span class="n">xpos</span><span class="p">,</span> <span class="n">ypos</span> <span class="o">=</span> <span class="p">(</span><span class="mf">0.4</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">)</span>
+        <span class="n">font</span> <span class="o">=</span> <span class="n">FONT</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
+        <span class="n">font</span><span class="o">.</span><span class="n">set_size</span><span class="p">(</span><span class="mi">14</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">textList</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">set_xlim</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">set_ylim</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">content</span> <span class="o">!=</span> <span class="s">&#39;?&#39;</span><span class="p">:</span>
+                <span class="nb">float</span><span class="p">(</span><span class="n">label</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">set_frame_on</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># mpl &gt;= 1.1.0</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">tight_layout</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">subplots_adjust</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> <span class="n">bottom</span><span class="o">=</span><span class="mf">0.1</span><span class="p">)</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">xpos</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">ypos</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">new_text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">xpos</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">ypos</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">label</span><span class="p">),</span>
+                                           <span class="n">fontproperties</span><span class="o">=</span><span class="n">font</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">textList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_text</span><span class="p">)</span>  
+        </div>
+<div class="viewcode-block" id="SmallPanel.erase_legend"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.erase_legend">[docs]</a>    <span class="k">def</span> <span class="nf">erase_legend</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Remove Legend</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#for ax in self.axes:</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">remove_legend</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="p">)</span>
+                     </div>
+<div class="viewcode-block" id="SmallPanel.onMouseMotion"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.onMouseMotion">[docs]</a>    <span class="k">def</span> <span class="nf">onMouseMotion</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Disable dragging 2D image</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+    </div>
+<div class="viewcode-block" id="SmallPanel.onWheel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.onWheel">[docs]</a>    <span class="k">def</span> <span class="nf">onWheel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+     </div>
+<div class="viewcode-block" id="SmallPanel.onLeftDown"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.onLeftDown">[docs]</a>    <span class="k">def</span> <span class="nf">onLeftDown</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Disables LeftDown</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+    </div>
+<div class="viewcode-block" id="SmallPanel.onPick"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.onPick">[docs]</a>    <span class="k">def</span> <span class="nf">onPick</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Remove Legend</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">ax</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">axes</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">remove_legend</span><span class="p">(</span><span class="n">ax</span><span class="p">)</span>
+                        
+    </div>
+<div class="viewcode-block" id="SmallPanel.draw"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.draw">[docs]</a>    <span class="k">def</span> <span class="nf">draw</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dimension</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
+            <span class="k">pass</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">canvas</span><span class="o">.</span><span class="n">resizing</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">tick_params</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="s">&#39;both&#39;</span><span class="p">,</span> <span class="n">labelsize</span><span class="o">=</span><span class="mi">9</span><span class="p">)</span>     
+            <span class="bp">self</span><span class="o">.</span><span class="n">erase_legend</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">canvas</span><span class="o">.</span><span class="n">draw_idle</span><span class="p">()</span> 
+            <span class="k">try</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">delaxes</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">axes</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+            
+       </div>
+<div class="viewcode-block" id="SmallPanel.onContextMenu"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.onContextMenu">[docs]</a>    <span class="k">def</span> <span class="nf">onContextMenu</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Default context menu for a plot panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">slicerpop</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">point</span>
+        <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">):</span>
+            <span class="n">slicerpop</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="s">&#39;&amp;Change Scale&#39;</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onProperties</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">slicerpop</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="s">&#39;&amp;Toggle Linear/Log Scale&#39;</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">ontogglescale</span><span class="p">)</span>     
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># mouse event</span>
+            <span class="n">pos_evt</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetPosition</span><span class="p">()</span>
+            <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ScreenToClient</span><span class="p">(</span><span class="n">pos_evt</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c"># toolbar event</span>
+            <span class="n">pos_x</span><span class="p">,</span> <span class="n">pos_y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">toolbar</span><span class="o">.</span><span class="n">GetPositionTuple</span><span class="p">()</span>
+            <span class="n">pos</span> <span class="o">=</span> <span class="p">(</span><span class="n">pos_x</span><span class="p">,</span> <span class="n">pos_y</span> <span class="o">+</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">PopupMenu</span><span class="p">(</span><span class="n">slicerpop</span><span class="p">,</span> <span class="n">pos</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="SmallPanel.ontogglescale"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.SmallPanel.ontogglescale">[docs]</a>    <span class="k">def</span> <span class="nf">ontogglescale</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span> 
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On toggle 2d scale</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_onToggleScale</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>  
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># mpl &gt;= 1.1.0</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">tight_layout</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">subplots_adjust</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> <span class="n">bottom</span><span class="o">=</span><span class="mf">0.1</span><span class="p">)</span> 
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">delaxes</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">axes</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_onProperties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        when clicking on Properties on context menu ,</span>
+<span class="sd">        The Property dialog is displayed</span>
+<span class="sd">        The user selects a transformation for x or y value and</span>
+<span class="sd">        a new plot is displayed</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="nb">list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="nb">list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">returnPlottable</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">first_item</span> <span class="o">=</span> <span class="nb">list</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="k">if</span> <span class="n">first_item</span><span class="o">.</span><span class="n">x</span> <span class="o">!=</span> <span class="p">[]:</span>
+                <span class="kn">from</span> <span class="nn">sas.plottools.PropertyDialog</span> <span class="kn">import</span> <span class="n">Properties</span>
+                <span class="n">dial</span> <span class="o">=</span> <span class="n">Properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Change Scale&#39;</span><span class="p">)</span>
+                <span class="c"># type of view or model used</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">xvalue</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">yvalue</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">view</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">xvalue</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span><span class="s">&quot;x&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">xvalue</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span><span class="s">&quot;log10(x)&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">yvalue</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span><span class="s">&quot;y&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">yvalue</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span><span class="s">&quot;log10(y)&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">view</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span><span class="s">&quot;--&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">view</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span><span class="s">&quot;Linear y vs x&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">setValues</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">prevXtrans</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">prevYtrans</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">viewModel</span><span class="p">)</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">Update</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">dial</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">xLabel</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">yLabel</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">viewModel</span> <span class="o">=</span> <span class="n">dial</span><span class="o">.</span><span class="n">getValues</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">viewModel</span> <span class="o">==</span> <span class="s">&quot;Linear y vs x&quot;</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">xLabel</span> <span class="o">=</span> <span class="s">&quot;x&quot;</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">yLabel</span> <span class="o">=</span> <span class="s">&quot;y&quot;</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">viewModel</span> <span class="o">=</span> <span class="s">&quot;--&quot;</span>
+                        <span class="n">dial</span><span class="o">.</span><span class="n">setValues</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">xLabel</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">yLabel</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">viewModel</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_onEVT_FUNC_PROPERTY</span><span class="p">()</span>
+                <span class="n">dial</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+         
+    <span class="k">def</span> <span class="nf">_onEVT_FUNC_PROPERTY</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">remove_fit</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Receive the x and y transformation from myDialog,</span>
+<span class="sd">        Transforms x and y in View</span>
+<span class="sd">        and set the scale</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="nb">list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="nb">list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">returnPlottable</span><span class="p">()</span>
+        <span class="c"># Changing the scale might be incompatible with</span>
+        <span class="c"># currently displayed data (for instance, going</span>
+        <span class="c"># from ln to log when all plotted values have</span>
+        <span class="c"># negative natural logs).</span>
+        <span class="c"># Go linear and only change the scale at the end.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_xscale</span><span class="p">(</span><span class="s">&quot;linear&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_yscale</span><span class="p">(</span><span class="s">&quot;linear&quot;</span><span class="p">)</span>
+        <span class="n">_xscale</span> <span class="o">=</span> <span class="s">&#39;linear&#39;</span>
+        <span class="n">_yscale</span> <span class="o">=</span> <span class="s">&#39;linear&#39;</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">:</span>
+            <span class="n">item</span><span class="o">.</span><span class="n">setLabel</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">xLabel</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">yLabel</span><span class="p">)</span>
+            <span class="c"># control axis labels from the panel itself</span>
+            <span class="n">yname</span><span class="p">,</span> <span class="n">yunits</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">get_yaxis</span><span class="p">()</span>
+            <span class="n">xname</span><span class="p">,</span> <span class="n">xunits</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">get_xaxis</span><span class="p">()</span>
+            <span class="c"># Goes through all possible scales</span>
+            <span class="c"># Goes through all possible scales</span>
+            <span class="k">if</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">xLabel</span> <span class="o">==</span> <span class="s">&quot;x&quot;</span><span class="p">):</span>
+                <span class="n">item</span><span class="o">.</span><span class="n">transformX</span><span class="p">(</span><span class="n">transform</span><span class="o">.</span><span class="n">toX</span><span class="p">,</span> <span class="n">transform</span><span class="o">.</span><span class="n">errToX</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">_xaxis_transformed</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">xname</span><span class="p">,</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">xunits</span><span class="p">)</span>
+            <span class="k">if</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">xLabel</span> <span class="o">==</span> <span class="s">&quot;log10(x)&quot;</span><span class="p">):</span>
+                <span class="n">item</span><span class="o">.</span><span class="n">transformX</span><span class="p">(</span><span class="n">transform</span><span class="o">.</span><span class="n">toX_pos</span><span class="p">,</span> <span class="n">transform</span><span class="o">.</span><span class="n">errToX_pos</span><span class="p">)</span>
+                <span class="n">_xscale</span> <span class="o">=</span> <span class="s">&#39;log&#39;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">_xaxis_transformed</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">xname</span><span class="p">,</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">xunits</span><span class="p">)</span>
+            <span class="k">if</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">yLabel</span> <span class="o">==</span> <span class="s">&quot;y&quot;</span><span class="p">):</span>
+                <span class="n">item</span><span class="o">.</span><span class="n">transformY</span><span class="p">(</span><span class="n">transform</span><span class="o">.</span><span class="n">toX</span><span class="p">,</span> <span class="n">transform</span><span class="o">.</span><span class="n">errToX</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">_yaxis_transformed</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">yname</span><span class="p">,</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">yunits</span><span class="p">)</span>
+            <span class="k">if</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">yLabel</span> <span class="o">==</span> <span class="s">&quot;log10(y)&quot;</span><span class="p">):</span>
+                <span class="n">item</span><span class="o">.</span><span class="n">transformY</span><span class="p">(</span><span class="n">transform</span><span class="o">.</span><span class="n">toX_pos</span><span class="p">,</span> <span class="n">transform</span><span class="o">.</span><span class="n">errToX_pos</span><span class="p">)</span>
+                <span class="n">_yscale</span> <span class="o">=</span> <span class="s">&#39;log&#39;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">_yaxis_transformed</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">yname</span><span class="p">,</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">yunits</span><span class="p">)</span>
+            <span class="n">item</span><span class="o">.</span><span class="n">transformView</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">prevXtrans</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">xLabel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">prevYtrans</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">yLabel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_xscale</span><span class="p">(</span><span class="n">_xscale</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_yscale</span><span class="p">(</span><span class="n">_yscale</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="DataOperatorWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperatorWindow">[docs]</a><span class="k">class</span> <span class="nc">DataOperatorWindow</span><span class="p">(</span><span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="p">):</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;size&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGTH</span><span class="p">)</span>
+        <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">DataOperPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_CLOSE</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnClose</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetPosition</span><span class="p">((</span><span class="mi">25</span><span class="p">,</span> <span class="mi">150</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">()</span>
+    
+<div class="viewcode-block" id="DataOperatorWindow.OnClose"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.data_operator.DataOperatorWindow.OnClose">[docs]</a>    <span class="k">def</span> <span class="nf">OnClose</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On close event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">data_operator_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">disconnect_panels</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+
+        </div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>
+
+    <span class="n">app</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">()</span>
+    <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span>
+    <span class="n">window</span> <span class="o">=</span> <span class="n">DataOperatorWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="p">[],</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Data Editor&quot;</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>
+ 
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/density_panel.html
===================================================================
--- _modules/sas/perspectives/calculator/density_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/density_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,512 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.density_panel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.density_panel</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">This module provide GUI for the mass density calculator</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span>
+<span class="kn">from</span> <span class="nn">wx.lib.scrolledpanel</span> <span class="kn">import</span> <span class="n">ScrolledPanel</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">check_float</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>  
+<span class="kn">from</span> <span class="nn">periodictable</span> <span class="kn">import</span> <span class="n">formula</span> <span class="k">as</span> <span class="n">Formula</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator</span> <span class="kn">import</span> <span class="n">calculator_widgets</span> <span class="k">as</span> <span class="n">widget</span>
+       
+<span class="n">AVOGADRO</span> <span class="o">=</span>  <span class="mf">6.02214129e23</span>
+<span class="n">_INPUTS</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;Mass Density&#39;</span><span class="p">,</span> <span class="s">&#39;Molar Volume&#39;</span><span class="p">]</span>
+<span class="n">_UNITS</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;g/cm^(3)     &#39;</span><span class="p">,</span> <span class="s">&#39;cm^(3)/mol &#39;</span><span class="p">]</span>
+<span class="c">#Density panel size </span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">410</span>
+    <span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">200</span>
+    <span class="n">PANEL_SIZE</span> <span class="o">=</span> <span class="mi">440</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">430</span>
+    <span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">200</span>
+    <span class="n">PANEL_SIZE</span> <span class="o">=</span> <span class="mi">460</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    
+<div class="viewcode-block" id="DensityPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.DensityPanel">[docs]</a><span class="k">class</span> <span class="nc">DensityPanel</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Provides the mass density calculator GUI.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal nickname for the window, used by the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;Mass Density Calculator&quot;</span>
+    <span class="c">## Name to appear on the window title bar</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;Mass Density Calculator&quot;</span>
+    <span class="c">## Flag to tell the AUI manager to put this panel in the center pane</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">True</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        <span class="c">#Font size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="c"># Object that receive status event</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">=</span> <span class="n">base</span>
+        <span class="c"># chemeical formula, string</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compound</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="c"># value of the density/volume, float</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">input</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># text controls</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">input_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">ctr_color</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetBackgroundColour</span><span class="p">()</span>
+        <span class="c"># button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># list</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_input_list</span> <span class="o">=</span> <span class="n">_INPUTS</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_input</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_unit_list</span> <span class="o">=</span> <span class="n">_UNITS</span>
+        <span class="c">#Draw the panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+       
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw window content</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># units</span>
+        <span class="n">unit_density</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unit_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">unit_volume</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unit_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+        
+        <span class="c"># sizers</span>
+        <span class="n">sizer_input</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">sizer_output</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">sizer_button</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer1</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</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>
+        <span class="n">sizer3</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>
+        <span class="n">vbox</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>
+        
+        <span class="c"># inputs</span>
+        <span class="n">inputbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Inputs&quot;</span><span class="p">)</span>
+        <span class="n">boxsizer1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">inputbox</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_STATICBOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">compound_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Molecular Formula &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compound_eg1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;     e.g., H2O&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compound_eg2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;e.g., D2O&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">input_cb</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">input_cb</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_select_input</span><span class="p">)</span> 
+        <span class="n">hint_input_name_txt</span> <span class="o">=</span> <span class="s">&#39;Mass or volume.&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">input_cb</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_input_name_txt</span><span class="p">)</span> 
+        <span class="n">unit_density1</span> <span class="o">=</span> <span class="s">&quot;     &quot;</span> <span class="o">+</span> <span class="n">unit_density</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">input_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">unit_input_density</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_density1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">unit_input_volume</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_volume</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">compound_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">compound_eg1</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">compound_eg2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">compound_eg1</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">input_cb</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">input_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span><span class="mi">1</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">unit_input_density</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span><span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">unit_input_density</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">unit_input_volume</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_input</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer1</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+        <span class="c"># outputs</span>
+        <span class="n">outputbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Outputs&quot;</span><span class="p">)</span>
+        <span class="n">boxsizer2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">outputbox</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">boxsizer2</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_STATICBOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        
+        <span class="n">molar_mass_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Molar Mass &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_ctl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ctr_color</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_unit1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;     g/mol&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_unit2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;g/mol&#39;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_cb</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output_cb</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_select_output</span><span class="p">)</span> 
+        <span class="n">hint_output_name_txt</span> <span class="o">=</span> <span class="s">&#39;Mass or volume.&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_cb</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_output_name_txt</span><span class="p">)</span> 
+        <span class="nb">list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_list</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+            <span class="nb">list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="nb">list</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">idx</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">)):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">input_cb</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="n">idx</span><span class="p">],</span><span class="n">idx</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output_cb</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="n">idx</span><span class="p">],</span><span class="n">idx</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">input_cb</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="s">&quot;Molar Volume&quot;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_cb</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="s">&quot;Mass Density&quot;</span><span class="p">)</span> 
+        <span class="n">unit_volume</span> <span class="o">=</span> <span class="s">&quot;     &quot;</span> <span class="o">+</span> <span class="n">unit_volume</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_ctl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ctr_color</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">unit_output_density</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_density</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">unit_output_volume</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_volume</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">molar_mass_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_unit1</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_unit2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_unit1</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output_cb</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span><span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">unit_output_volume</span><span class="p">,</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">unit_output_density</span><span class="p">,</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">unit_output_volume</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">boxsizer2</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_output</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer2</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+        <span class="c"># buttons</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Calculate&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Calculate.&quot;</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">calculate</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>   
+        
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">250</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</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">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="n">sizer3</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_button</span><span class="p">)</span>
+        
+        <span class="c"># layout</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer1</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer3</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Fit</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="DensityPanel.on_select_input"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.DensityPanel.on_select_input">[docs]</a>    <span class="k">def</span> <span class="nf">on_select_input</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On selection of input combobox, </span>
+<span class="sd">        update units and output combobox</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        
+        <span class="n">combo</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_input</span> <span class="o">=</span> <span class="n">combo</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_list</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input</span> <span class="o">!=</span> <span class="n">name</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_output</span> <span class="o">=</span> <span class="n">name</span>
+                <span class="k">break</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="DensityPanel.on_select_output"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.DensityPanel.on_select_output">[docs]</a>    <span class="k">def</span> <span class="nf">on_select_output</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On selection of output combobox, </span>
+<span class="sd">        update units and input combobox</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        
+        <span class="n">combo</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_output</span> <span class="o">=</span> <span class="n">combo</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_list</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_output</span> <span class="o">!=</span> <span class="n">name</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_input</span> <span class="o">=</span> <span class="n">name</span>
+                <span class="k">break</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+  </div>
+<div class="viewcode-block" id="DensityPanel.set_values"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.DensityPanel.set_values">[docs]</a>    <span class="k">def</span> <span class="nf">set_values</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Sets units and combobox values</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="nb">input</span><span class="p">,</span> <span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_input</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">input</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c"># input</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">input_cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="nb">input</span><span class="p">))</span>
+        <span class="c"># output</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">output</span><span class="p">))</span>
+        <span class="c"># unit</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input_list</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="nb">input</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_unit1</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_unit2</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">compound_eg1</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">compound_eg2</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">unit_input_density</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">unit_output_volume</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">unit_input_volume</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">unit_output_density</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span> 
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_unit1</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_unit2</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">compound_eg1</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">compound_eg2</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">unit_input_volume</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">unit_output_density</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">unit_input_density</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">unit_output_volume</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="c"># layout    </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">clear_outputs</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer1</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>    
+        </div>
+<div class="viewcode-block" id="DensityPanel.get_input"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.DensityPanel.get_input">[docs]</a>    <span class="k">def</span> <span class="nf">get_input</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return the current input and output combobox values</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_input</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_output</span>
+    </div>
+<div class="viewcode-block" id="DensityPanel.check_inputs"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.DensityPanel.check_inputs">[docs]</a>    <span class="k">def</span> <span class="nf">check_inputs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check validity user inputs</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">input_ctl</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">input</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">input_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="n">input_type</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">input_cb</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Error for </span><span class="si">%s</span><span class="s"> value :expect float&quot;</span><span class="o">%</span> <span class="n">input_type</span>
+                
+        <span class="bp">self</span><span class="o">.</span><span class="n">compound</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">compound</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="k">try</span> <span class="p">:</span>
+                <span class="n">Formula</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">compound</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Enter correct formula&quot;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Enter Formula&quot;</span>
+        <span class="k">return</span> <span class="n">flag</span><span class="p">,</span> <span class="n">msg</span>
+        
+</div>
+<div class="viewcode-block" id="DensityPanel.calculate"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.DensityPanel.calculate">[docs]</a>    <span class="k">def</span> <span class="nf">calculate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Calculate the mass Density/molar Volume of the molecules</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">clear_outputs</span><span class="p">()</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c">#Check validity user inputs</span>
+            <span class="n">flag</span><span class="p">,</span> <span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">check_inputs</span><span class="p">()</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">msg</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Density/Volume Calculator: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+               <span class="k">return</span> 
+            <span class="c">#get ready to compute</span>
+            <span class="n">mol_formula</span> <span class="o">=</span> <span class="n">Formula</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">compound</span><span class="p">)</span>
+            <span class="n">molar_mass</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">mol_formula</span><span class="o">.</span><span class="n">molecular_mass</span><span class="p">)</span> <span class="o">*</span> <span class="n">AVOGADRO</span>
+            <span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_format_number</span><span class="p">(</span><span class="n">molar_mass</span> <span class="o">/</span> <span class="bp">self</span><span class="o">.</span><span class="n">input</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_format_number</span><span class="p">(</span><span class="n">molar_mass</span><span class="p">)))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">output</span><span class="p">))</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Density/Volume Calculator: </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            </div>
+<div class="viewcode-block" id="DensityPanel.clear_outputs"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.DensityPanel.clear_outputs">[docs]</a>    <span class="k">def</span> <span class="nf">clear_outputs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Clear the outputs textctrl</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">molar_mass_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_format_number</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return a float in a standardized, human-readable formatted string </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span> 
+            <span class="n">value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">output</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+            <span class="k">return</span> <span class="n">output</span>
+
+        <span class="n">output</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%-12.5f</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span>
+        <span class="k">return</span> <span class="n">output</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>  
+        </div>
+<div class="viewcode-block" id="DensityWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.DensityWindow">[docs]</a><span class="k">class</span> <span class="nc">DensityWindow</span><span class="p">(</span><span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Density/Volume Calculator&quot;</span><span class="p">,</span>
+                  <span class="n">base</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_SIZE</span><span class="p">,</span> <span class="n">PANEL_SIZE</span><span class="o">/</span><span class="mf">1.7</span><span class="p">),</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">size</span>
+        <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">DensityPanel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="n">base</span><span class="p">)</span>
+        <span class="bp">self</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_CLOSE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetPosition</span><span class="p">((</span><span class="mi">25</span><span class="p">,</span> <span class="mi">160</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="DensityWindow.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.DensityWindow.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On close event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">cal_md_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        
+        </div></div>
+<div class="viewcode-block" id="ViewApp"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.ViewApp">[docs]</a><span class="k">class</span> <span class="nc">ViewApp</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+<div class="viewcode-block" id="ViewApp.OnInit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.density_panel.ViewApp.OnInit">[docs]</a>    <span class="k">def</span> <span class="nf">OnInit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">DensityWindow</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Density/Volume Calculator&quot;</span><span class="p">)</span>    
+        <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTopWindow</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">True</span>
+        
+</div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">app</span> <span class="o">=</span> <span class="n">ViewApp</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>     
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/detector_editor.html
===================================================================
--- _modules/sas/perspectives/calculator/detector_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/detector_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,954 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.detector_editor &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.detector_editor</h1><div class="highlight"><pre>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">deepcopy</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Detector</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">check_float</span>
+
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">60</span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">465</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">450</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">480</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">550</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">480</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    
+<span class="k">class</span> <span class="nc">DetectorDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+<div class="viewcode-block" id="DetectorDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog">[docs]</a>    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">detector</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                        <span class="n">title</span><span class="o">=</span><span class="s">&quot;Detector Editor&quot;</span><span class="p">,</span>
+                        <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">)):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span> <span class="o">=</span> <span class="n">detector</span>
+          
+            <span class="bp">self</span><span class="o">.</span><span class="n">_reset_detector</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_description</span> <span class="o">=</span> <span class="s">&quot;Edit Detector&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">print</span> <span class="s">&quot;error&quot;</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+           
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            define initial sizer </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_detector</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="nb">str</span><span class="p">(</span><span class="s">&quot;Edit Selected Detector&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_detector</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_detector</span><span class="p">,</span>
+                                                    <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">detector_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Edit Number of Detectors&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">detector_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_sizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_STATICBOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_button_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_hint_sizer</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>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_button_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_hint_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">instrument_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">offset_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pixel_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+       
+    <span class="k">def</span> <span class="nf">_layout_detector</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for detector related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">detector_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Detector:&quot;</span><span class="p">)</span> 
+        <span class="n">hint_detector_txt</span> <span class="o">=</span> <span class="s">&#39;Current available detector.&#39;</span>
+        <span class="n">detector_name_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_detector_txt</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="n">hint_detector_name_txt</span> <span class="o">=</span> <span class="s">&#39;Name of detectors.&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_detector_name_txt</span><span class="p">)</span> 
+   
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_detector</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Add&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_detector</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Add data&#39;s detector.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_add_detector</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">add_detector</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_detector</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Remove&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_detector</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Remove data&#39;s detector.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_detector</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">remove_detector</span><span class="p">)</span>
+      
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">detector_name_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_add_detector</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_detector</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="n">detector_hint_txt</span> <span class="o">=</span> <span class="s">&#39;No detector is available for this data.&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">detector_hint_txt</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_hint_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">detector_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">detector_button_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">detector_hint_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+     
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_detector_combox</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_detector</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_instrument_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for instrument related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Instrument</span>
+        <span class="n">instrument_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Instrument Name : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">instrument_name_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">5</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">instrument_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">instrument_name_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">instrument_name_tcl</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">EXPAND</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_layout_distance</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for distance related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">distance_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Sample to Detector Distance : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="n">distance_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">distance_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distance_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">distance_unit_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distance_unit_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_offset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for offset related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Offset</span>
+        <span class="n">offset_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Offset:&#39;</span><span class="p">)</span> 
+        <span class="n">x_offset_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;x = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_offset_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                        <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">y_offset_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;y = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_offset_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">z_offset_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;z = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_offset_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="n">offset_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">offset_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">offset_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">offset_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">x_offset_txt</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">LEFT</span><span class="p">,</span> <span class="mi">30</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_offset_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">y_offset_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_offset_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">z_offset_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_offset_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">offset_unit_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">offset_unit_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+         
+    <span class="k">def</span> <span class="nf">_layout_orientation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for orientation related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Orientation</span>
+        <span class="n">orientation_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Orientation:&#39;</span><span class="p">)</span> 
+        <span class="n">x_orientation_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;x = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_orientation_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">y_orientation_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;y = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_orientation_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">z_orientation_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;z = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_orientation_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="n">orientation_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">orientation_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">x_orientation_txt</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">LEFT</span><span class="p">,</span> <span class="mi">7</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_orientation_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">y_orientation_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_orientation_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">z_orientation_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_orientation_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">orientation_unit_txt</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">EXPAND</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_unit_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span> 
+        
+    <span class="k">def</span> <span class="nf">_layout_beam_center</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for beam center related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Beam center</span>
+        <span class="n">beam_center_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Beam Center:&#39;</span><span class="p">)</span> 
+        <span class="n">x_beam_center_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;x = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_beam_center_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">y_beam_center_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;y = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_beam_center_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">z_beam_center_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;z = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_beam_center_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="n">beam_center_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_center_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">beam_center_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">x_beam_center_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_beam_center_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">y_beam_center_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_beam_center_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">z_beam_center_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_beam_center_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">beam_center_unit_txt</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">EXPAND</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">beam_center_unit_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>   
+    
+    <span class="k">def</span> <span class="nf">_layout_pixel_size</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for pixel size related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Pixel Size</span>
+        <span class="n">pixel_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Pixel Size:&#39;</span><span class="p">)</span> 
+        <span class="n">x_pixel_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;x = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_pixel_size_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">y_pixel_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;y = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_pixel_size_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">z_pixel_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;z = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_pixel_size_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="n">pixel_size_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">pixel_size_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">pixel_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">pixel_size_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">x_pixel_size_txt</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">LEFT</span><span class="p">,</span> <span class="mi">17</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_pixel_size_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">y_pixel_size_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_pixel_size_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">z_pixel_size_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_pixel_size_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">pixel_size_unit_txt</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">EXPAND</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pixel_size_unit_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_slit_length</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for slit length related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#slit length</span>
+        <span class="n">slit_length_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Slit Length: &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_length_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="n">slit_length_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_length_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>   
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">slit_length_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">slit_length_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">slit_length_unit_txt</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">EXPAND</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">slit_length_unit_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;Apply&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_apply</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Apply current changes to the detector.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;Cancel&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Cancel current changes.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_cancel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span><span class="s">&#39;Close&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close window.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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">LEFT</span><span class="p">,</span> <span class="mi">200</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">             Draw the current panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_detector</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_instrument_sizer</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_distance</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_offset</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_orientation</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_beam_center</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_pixel_size</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_slit_length</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+     
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_detector</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">instrument_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distance_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">offset_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">beam_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pixel_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">slit_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">detector_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_detector</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">reset_detector</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="DetectorDialog.reset_detector"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.reset_detector">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            put the default value of the detector back to the current detector</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_reset_detector</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_detector_combox</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.set_manager">[docs]</a>        <span class="sd">&quot;&quot;&quot;    </span>
+<span class="sd">            Set manager of this window</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        
+    <span class="k">def</span> <span class="nf">fill_detector_combox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.fill_detector_combox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.fill_detector_combox">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            fill the current combobox with the available detector</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">detector</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span><span class="p">:</span>
+            <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+            
+    <span class="k">def</span> <span class="nf">reset_detector_combobox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">edited_detector</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.reset_detector_combobox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.reset_detector_combobox">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            take all edited editor and reset clientdata of detector combo box</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">position</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()):</span>
+            <span class="n">detector</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">detector</span> <span class="o">==</span> <span class="n">edited_detector</span><span class="p">:</span>
+                <span class="n">detector</span> <span class="o">=</span> <span class="n">edited_detector</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetString</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+                <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+         
+    <span class="k">def</span> <span class="nf">add_detector</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.add_detector"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.add_detector">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Append empty detector to data&#39;s list of detector</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+        <span class="n">detector</span> <span class="o">=</span> <span class="n">Detector</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">detector</span><span class="p">)</span>
+        <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">position</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_detector</span><span class="p">()</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">remove_detector</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.remove_detector"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.remove_detector">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Remove detector to data&#39;s list of detector</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+                <span class="n">detector</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">detector</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">detector</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">Delete</span><span class="p">(</span><span class="n">position</span><span class="p">)</span> 
+                    <span class="c">#set the combo box box the next available item</span>
+                    <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="n">position</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">position</span> <span class="o">-=</span> <span class="mi">1</span> 
+                    <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="c">#disable or enable the combo box when necessary</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_detector</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">enable_detector</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.enable_detector"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.enable_detector">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Enable /disable widgets crelated to detector</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_detector</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="n">n_detector</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span>
+            <span class="n">detector_hint_txt</span> <span class="o">=</span> <span class="s">&#39;Detectors available: </span><span class="si">%s</span><span class="s"> &#39;</span><span class="o">%</span><span class="nb">str</span><span class="p">(</span><span class="n">n_detector</span><span class="p">)</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_detector</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_detector</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_detector</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bt_remove_detector</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="n">detector_hint_txt</span> <span class="o">=</span> <span class="s">&#39;No detector is available for this data.&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_txt</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">detector_hint_txt</span><span class="p">)</span>
+           
+    <span class="k">def</span> <span class="nf">set_detector</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">detector</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.set_detector"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.set_detector">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            set detector for data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="o">==</span> <span class="n">detector</span><span class="p">:</span>
+                    <span class="n">item</span> <span class="o">=</span> <span class="n">detector</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">reset_detector_combobox</span><span class="p">(</span><span class="n">edited_detector</span><span class="o">=</span><span class="n">detector</span><span class="p">)</span>
+                    <span class="k">return</span>
+                
+    <span class="k">def</span> <span class="nf">get_current_detector</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.get_current_detector"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.get_current_detector">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span>
+        <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span> 
+        <span class="k">if</span> <span class="n">position</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">NOT_FOUND</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span>
+        <span class="n">detector_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">GetStringSelection</span><span class="p">()</span> 
+        <span class="n">detector</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">detector</span><span class="p">,</span> <span class="n">detector_name</span><span class="p">,</span> <span class="n">position</span>
+    
+    <span class="k">def</span> <span class="nf">set_values</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.set_values"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.set_values">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            take the detector values of the current data and display them</span>
+<span class="sd">            through the panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">detector</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_detector</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">instrument_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+        <span class="c">#Distance</span>
+        <span class="n">distance</span> <span class="o">=</span> <span class="n">detector</span><span class="o">.</span><span class="n">distance</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">distance</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">distance_unit</span><span class="p">))</span>
+        <span class="c">#Offset</span>
+        <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span> <span class="o">=</span> <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">y</span> <span class="p">,</span> <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">z</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_offset_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_offset_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">y</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_offset_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">offset_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">offset_unit</span><span class="p">))</span>
+        <span class="c">#Orientation</span>
+        <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span>
+        <span class="n">z</span> <span class="o">=</span> <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_orientation_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_orientation_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">y</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_orientation_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">orientation_unit</span><span class="p">))</span>
+        <span class="c">#Beam center</span>
+        <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">y</span>
+        <span class="n">z</span>  <span class="o">=</span>   <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">z</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_beam_center_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_beam_center_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">y</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_beam_center_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_center_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">beam_center_unit</span><span class="p">))</span>
+        <span class="c">#Pixel size </span>
+        <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">y</span>
+        <span class="n">z</span> <span class="o">=</span> <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">z</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_pixel_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_pixel_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">y</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_pixel_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">pixel_size_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">pixel_size_unit</span><span class="p">))</span>
+        <span class="c">#Slit length</span>
+        <span class="n">slit_length</span> <span class="o">=</span> <span class="n">detector</span><span class="o">.</span><span class="n">slit_length</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_length_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">slit_length</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_length_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">slit_length_unit</span><span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">get_detector</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.get_detector"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.get_detector">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            return the current detector</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span>
+    
+    <span class="k">def</span> <span class="nf">get_notes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.get_notes"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.get_notes">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            return notes</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span>
+    
+    <span class="k">def</span> <span class="nf">on_change_instrument</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.on_change_instrument"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.on_change_instrument">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change instrument</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">detector</span><span class="p">,</span> <span class="n">detector_name</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_detector</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="k">return</span>
+        <span class="c">#Change the name of the detector</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">instrument_name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">name</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">detector_name</span> <span class="o">!=</span> <span class="n">name</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Instrument&#39;s &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;name from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector_name</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetString</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+        
+    <span class="k">def</span> <span class="nf">on_change_distance</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.on_change_distance"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.on_change_distance">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change distance of the sample to the detector</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">detector</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_detector</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c">#Change the distance</span>
+        <span class="n">distance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">distance_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">distance</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">distance</span>  <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">distance</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">distance</span> <span class="o">=</span> <span class="n">distance</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distance_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">distance</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">distance</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change Distance from&quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">distance</span><span class="p">,</span> <span class="n">distance</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">distance</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">distance</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; the distance won&#39;t changes &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">distance</span><span class="p">,</span> <span class="n">distance</span><span class="p">)</span>
+        <span class="c">#change the distance unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">distance_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">distance_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change distance&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">distance_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetString</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+        
+    <span class="k">def</span> <span class="nf">on_change_offset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.on_change_offset"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.on_change_offset">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change the detector offset</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">detector</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_detector</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c">#Change x coordinate</span>
+        <span class="n">x_offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_offset_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">x_offset</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">x_offset</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">x_offset</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">x_offset</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_offset_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">x</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_offset</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change x of offset from&quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                                      <span class="n">x_offset</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_offset</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the offset &#39;s x &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes x offset&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">x_offset</span><span class="p">)</span>
+        <span class="c">#Change y coordinate</span>
+        <span class="n">y_offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_offset_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">y_offset</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">y_offset</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">y_offset</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">y_offset</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_offset_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">y</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_offset</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change y of offset from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">y</span><span class="p">,</span> <span class="n">y_offset</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_offset</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the offset &#39;s y &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes y &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;offset from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                                         <span class="n">y_offset</span><span class="p">)</span>
+        <span class="c">#Change z coordinate</span>
+        <span class="n">z_offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_offset_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">z_offset</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">z_offset</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">z_offset</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="n">z_offset</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_offset_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">z</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_offset</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change z of offset from&quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                                              <span class="n">z_offset</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">z</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_offset</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the offset &#39;s x &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes z&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;offset from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">z</span><span class="p">,</span> 
+                                                       <span class="n">z_offset</span><span class="p">)</span>
+        <span class="c">#change the offset unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">offset_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">offset_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change Offset&#39;s&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;unit from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">offset_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetString</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+        
+    <span class="k">def</span> <span class="nf">on_change_orientation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.on_change_orientation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.on_change_orientation">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change the detector orientation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">detector</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_detector</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c">#Change x coordinate</span>
+        <span class="n">x_orientation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_orientation_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">x_orientation</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">x_orientation</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">x_orientation</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">x_orientation</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_orientation_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_orientation</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change x of orientation from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                                   <span class="n">x_orientation</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_orientation</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the orientation &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;&#39;s x  won&#39;t changes x orientation from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                              <span class="n">x_orientation</span><span class="p">)</span>
+        <span class="c">#Change y coordinate</span>
+        <span class="n">y_orientation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_orientation_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">y_orientation</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">y_orientation</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">y_orientation</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">y_orientation</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_orientation_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_orientation</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change y of orientation from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                                     <span class="n">y_orientation</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_orientation</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the orientation&#39;s &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; y won&#39;t changes y orientation from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                            <span class="n">y_orientation</span><span class="p">)</span>
+        <span class="c">#Change z coordinate</span>
+        <span class="n">z_orientation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_orientation_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">z_orientation</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">z_orientation</span>  <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">z_orientation</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="n">z_orientation</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_orientation_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_orientation</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change z of offset from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                                   <span class="n">z_orientation</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_orientation</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the orientation &#39;s&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; x won&#39;t changes z orientation from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                              <span class="n">z_orientation</span><span class="p">)</span>
+        <span class="c">#change the orientation unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">orientation_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change orientation&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">orientation_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetString</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+        
+    <span class="k">def</span> <span class="nf">on_change_beam_center</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.on_change_beam_center"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.on_change_beam_center">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change the detector beam center</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+       
+        <span class="n">detector</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_detector</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c">#Change x coordinate</span>
+        <span class="n">x_beam_center</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_beam_center_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">x_beam_center</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">x_beam_center</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">x_beam_center</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">x_beam_center</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_beam_center_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">x</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_beam_center</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change x of offset from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                                     <span class="n">x_beam_center</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">x</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_beam_center</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the beam &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;center &#39;s x won&#39;t changes x beam center from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                            <span class="n">x_beam_center</span><span class="p">)</span>
+        <span class="c">#Change y coordinate</span>
+        <span class="n">y_beam_center</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_beam_center_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">y_beam_center</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">y_beam_center</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">y_beam_center</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">y</span>  <span class="o">=</span> <span class="n">y_beam_center</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_beam_center_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">y</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_beam_center</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change y of beam center from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                                     <span class="n">y_beam_center</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">y</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_beam_center</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the beam &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;center &#39;s y won&#39;t changes y beam center from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                              <span class="n">y_beam_center</span><span class="p">)</span>
+        <span class="c">#Change z coordinate</span>
+        <span class="n">z_beam_center</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_beam_center_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">z_beam_center</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">z_beam_center</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">z_beam_center</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="n">z_beam_center</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_beam_center_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">z</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_beam_center</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change z of beam center from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                                     <span class="n">z_beam_center</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">z</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_beam_center</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the offset &#39;s x &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes z beam center from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                            <span class="n">z_beam_center</span><span class="p">)</span>
+        <span class="c">#change the beam center unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">beam_center_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">beam_center_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change beam center&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">beam_center_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetString</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+        
+    <span class="k">def</span> <span class="nf">on_change_pixel_size</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.on_change_pixel_size"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.on_change_pixel_size">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change the detector pixel size</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">detector</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_detector</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c">#Change x coordinate</span>
+        <span class="n">x_pixel_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_pixel_size_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">x_pixel_size</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">x_pixel_size</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">x_pixel_size</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_pixel_size_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">x</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_pixel_size</span><span class="p">)</span> <span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change x of pixel size from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                                   <span class="n">x_pixel_size</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">x</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_pixel_size</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the pixel&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; size &#39;s x  won&#39;t changes x pixel size from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> 
+                                             <span class="n">x_pixel_size</span><span class="p">)</span>
+        <span class="c">#Change y coordinate</span>
+        <span class="n">y_pixel_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_pixel_size_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">y_pixel_size</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">y_pixel_size</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">y_pixel_size</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">y_pixel_size</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_pixel_size_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">y</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_pixel_size</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change y of pixel size from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                                   <span class="n">y_pixel_size</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">y</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_pixel_size</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the pixel &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;size&#39;s y  won&#39;t changes y pixel size from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                              <span class="n">y_pixel_size</span><span class="p">)</span>
+        <span class="c">#Change z coordinate</span>
+        <span class="n">z_pixel_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_pixel_size_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">z_pixel_size</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">z_pixel_size</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">z_pixel_size</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="n">z_pixel_size</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_pixel_size_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">z</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_pixel_size</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change z of pixel size from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                                   <span class="n">z_pixel_size</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">z</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_pixel_size</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the offset &#39;s x &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes z pixel size from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">z</span><span class="p">,</span> <span class="n">z_pixel_size</span><span class="p">)</span>
+        <span class="c">#change the beam center unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pixel_size_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change pixel size&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">pixel_size_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetString</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+           
+    <span class="k">def</span> <span class="nf">on_change_slit_length</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.on_change_slit_length"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.on_change_slit_length">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change slit length of the detector</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">detector</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_current_detector</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c">#Change the distance</span>
+        <span class="n">slit_length</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_length_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">slit_length</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">slit_length</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">slit_length</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">detector</span><span class="o">.</span><span class="n">slit_length</span> <span class="o">=</span> <span class="n">slit_length</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">slit_length_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">slit_length</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">slit_length</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change slit length from&quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">slit_length</span><span class="p">,</span>
+                                                    <span class="n">slit_length</span><span class="p">)</span>
+                    <span class="n">detector</span><span class="o">.</span><span class="n">slit_length</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">slit_length</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; for the slit length won&#39;t changes &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">slit_length</span><span class="p">,</span> <span class="n">slit_length</span><span class="p">)</span>
+        <span class="c">#change the distance unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_length_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">detector</span><span class="o">.</span><span class="n">slit_length_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change slit length&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">slit_length_unit_tcl</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span> 
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetString</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">position</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">detector</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> 
+            
+    <span class="k">def</span> <span class="nf">on_click_cancel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.on_click_cancel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.on_click_cancel">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            reset the current detector to its initial values</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_detector</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+             <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">set_detector</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_detector</span><span class="p">)</span>
+             
+    <span class="k">def</span> <span class="nf">on_click_apply</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DetectorDialog.on_click_apply"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.detector_editor.DetectorDialog.on_click_apply">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Apply user values to the detector</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_instrument</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_distance</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_instrument</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_beam_center</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_offset</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_orientation</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_pixel_size</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_slit_length</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">detector</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_detector</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">set_detector</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_detector</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span><span class="p">)</span>
+            
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div></div>
+    <span class="n">app</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">()</span>
+    <span class="n">test_detector</span> <span class="o">=</span> <span class="n">Detector</span><span class="p">()</span>
+    <span class="n">dlg</span> <span class="o">=</span> <span class="n">DetectorDialog</span><span class="p">(</span><span class="n">detector</span><span class="o">=</span><span class="p">[</span><span class="n">test_detector</span><span class="p">])</span>
+    <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>
+ 
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/gen_scatter_panel.html
===================================================================
--- _modules/sas/perspectives/calculator/gen_scatter_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/gen_scatter_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,2236 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.gen_scatter_panel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.gen_scatter_panel</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Generic Scattering panel. </span>
+<span class="sd">This module relies on guiframe manager.</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">numpy</span>
+<span class="c">#import math</span>
+<span class="kn">import</span> <span class="nn">wx.aui</span> <span class="kn">as</span> <span class="nn">aui</span>
+<span class="c">#import wx.lib.agw.aui as aui</span>
+<span class="kn">import</span> <span class="nn">logging</span>
+<span class="kn">import</span> <span class="nn">time</span>
+
+<span class="kn">import</span> <span class="nn">matplotlib</span>
+<span class="n">matplotlib</span><span class="o">.</span><span class="n">interactive</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+<span class="c">#Use the WxAgg back end. The Wx one takes too long to render</span>
+<span class="n">matplotlib</span><span class="o">.</span><span class="n">use</span><span class="p">(</span><span class="s">&#39;WXAgg&#39;</span><span class="p">)</span>
+
+<span class="c">#from sas.guiframe.gui_manager import MDIFrame</span>
+<span class="kn">from</span> <span class="nn">sas.data_util.calcthread</span> <span class="kn">import</span> <span class="n">CalcThread</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.local_perspectives.plotting.SimplePlot</span> <span class="kn">import</span> <span class="n">PlotFrame</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">Data2D</span> 
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">Data1D</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Detector</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Source</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">format_number</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>  
+<span class="kn">from</span> <span class="nn">sas.calculator</span> <span class="kn">import</span> <span class="n">sas_gen</span> 
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.calculator_widgets</span> <span class="kn">import</span> <span class="n">OutputTextCtrl</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.calculator_widgets</span> <span class="kn">import</span> <span class="n">InputTextCtrl</span>
+<span class="kn">from</span> <span class="nn">wx.lib.scrolledpanel</span> <span class="kn">import</span> <span class="n">ScrolledPanel</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.load_thread</span> <span class="kn">import</span> <span class="n">GenReader</span>
+<span class="kn">from</span> <span class="nn">sas.plottools.arrow3d</span> <span class="kn">import</span> <span class="n">Arrow3D</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator</span> <span class="kn">import</span> <span class="n">calculator_widgets</span> <span class="k">as</span> <span class="n">widget</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">NewPlotEvent</span>    
+
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">76</span>
+<span class="c">#Slit length panel size </span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">570</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">370</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">620</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">370</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+<span class="n">_QMAX_DEFAULT</span> <span class="o">=</span> <span class="mf">0.3</span>
+<span class="n">_NPTS_DEFAULT</span> <span class="o">=</span> <span class="mi">50</span> 
+<span class="n">_Q1D_MIN</span> <span class="o">=</span> <span class="mf">0.001</span>
+
+<div class="viewcode-block" id="add_icon"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.add_icon">[docs]</a><span class="k">def</span> <span class="nf">add_icon</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="n">frame</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Add icon in the frame</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">if</span> <span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">frame</span><span class="p">,</span> <span class="s">&quot;IsIconized&quot;</span><span class="p">):</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">frame</span><span class="o">.</span><span class="n">IsIconized</span><span class="p">():</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">icon</span> <span class="o">=</span> <span class="n">parent</span><span class="o">.</span><span class="n">GetIcon</span><span class="p">()</span>
+                    <span class="n">frame</span><span class="o">.</span><span class="n">SetIcon</span><span class="p">(</span><span class="n">icon</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>  
+</div>
+<span class="k">def</span> <span class="nf">_set_error</span><span class="p">(</span><span class="n">panel</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">show_msg</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">    Set_error dialog</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">if</span> <span class="n">item</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">item</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+        <span class="n">item</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+    <span class="k">if</span> <span class="n">show_msg</span><span class="p">:</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error: wrong (or out of range) value entered.&quot;</span>
+        <span class="k">if</span> <span class="n">panel</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="n">panel</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;Error&#39;</span> <span class="p">))</span> 
+            <span class="n">panel</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+    <span class="k">return</span> <span class="bp">False</span>
+
+<div class="viewcode-block" id="CalcGen"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.CalcGen">[docs]</a><span class="k">class</span> <span class="nc">CalcGen</span><span class="p">(</span><span class="n">CalcThread</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Computation</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
+                 <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span>
+                 <span class="nb">input</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">completefn</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">updatefn</span>   <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="c">#elapsed = 0,</span>
+                 <span class="n">yieldtime</span>  <span class="o">=</span> <span class="mf">0.01</span><span class="p">,</span>
+                 <span class="n">worktime</span>   <span class="o">=</span> <span class="mf">0.01</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">CalcThread</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">completefn</span><span class="p">,</span>
+                 <span class="n">updatefn</span><span class="p">,</span>
+                 <span class="n">yieldtime</span><span class="p">,</span>
+                 <span class="n">worktime</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">id</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">input</span> <span class="o">=</span> <span class="nb">input</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">update_fn</span> <span class="o">=</span> <span class="n">updatefn</span>
+        
+<div class="viewcode-block" id="CalcGen.compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.CalcGen.compute">[docs]</a>    <span class="k">def</span> <span class="nf">compute</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        excuting computation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#elapsed = time.time() - self.starttime</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">input</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">update_fn</span><span class="p">)</span>
+            </div></div>
+<div class="viewcode-block" id="SasGenPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel">[docs]</a><span class="k">class</span> <span class="nc">SasGenPanel</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Provides the sas gen calculator GUI.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal nickname for the window, used by the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;Generic SAS Calculator&quot;</span>
+    <span class="c">## Name to appear on the window title bar</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;Generic SAS &quot;</span>
+    <span class="c">## Flag to tell the AUI manager to put this panel in the center pane</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">True</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</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">RAISED_BORDER</span><span class="p">,</span> 
+                               <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="c">#kwds[&#39;style&#39;] = wx.SUNKEN_BORDER</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="c">#Font size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        <span class="c">#thread to read data </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="s">&#39;GenSAS&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">file_name</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">time_text</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orient_combo</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">omfreader</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">OMFReader</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sldreader</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">SLDReader</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pdbreader</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">PDBReader</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">GenSAS</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_dic</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">params</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">scale2d</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="n">_QMAX_DEFAULT</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span> <span class="o">=</span> <span class="n">_NPTS_DEFAULT</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph_num</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">default_shape</span> <span class="o">=</span> <span class="s">&#39;rectangular&#39;</span>
+        <span class="c"># Object that receive status event</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_create_default_sld_data</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_create_default_2d_data</span><span class="p">()</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_set_sld_data_helper</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Define the main sizers building to build this application.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_source</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="s">&quot;SLD Data File&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_parameters</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="s">&quot;Input Parameters&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_qrange</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="s">&quot;Q Range&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_source</span><span class="p">,</span>
+                                                    <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_parameters</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_parameters</span><span class="p">,</span>
+                                                    <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_qrange</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_qrange</span><span class="p">,</span>
+                                                    <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">shape_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qrange_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+       
+    <span class="k">def</span> <span class="nf">_layout_data_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Fill the sizer containing data&#39;s name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Data: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">*</span> <span class="mi">4</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">data_hint</span> <span class="o">=</span> <span class="s">&quot;Loaded data&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">data_hint</span><span class="p">)</span>
+        <span class="c">#control that triggers importing data</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">browse_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Load&quot;</span><span class="p">)</span>
+        <span class="n">hint_on_browse</span> <span class="o">=</span> <span class="s">&quot;Click on this button to load a data in this panel.&quot;</span>
+        <span class="c">#self.browse_button.SetToolTipString(hint_on_browse)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_load_data</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">data_name_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">browse_button</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_layout_param_size</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Fill the sizer containing slit size information</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
+        <span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span>
+        <span class="n">details</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span>
+        <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">params</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">param_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Parameter&#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">param_title</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">value_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Value&#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">value_title</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">unit_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit&#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">unit_title</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">key_list</span> <span class="o">=</span> <span class="n">params</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
+        <span class="n">key_list</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">key_list</span><span class="p">:</span>
+            <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="n">p_name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">param</span><span class="p">)</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">p_name</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="c">## add parameter value</span>
+            <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">param</span><span class="p">)</span>
+            <span class="n">ctl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">*</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+            <span class="c">#ctl.SetToolTipString(\</span>
+            <span class="c">#            &quot;Hit &#39;Enter&#39; after typing to update the plot.&quot;)</span>
+            <span class="n">ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="bp">True</span><span class="p">))</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+            <span class="c">## add unit</span>
+            <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">unit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">details</span><span class="p">[</span><span class="n">param</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">p_name</span><span class="p">,</span> <span class="n">ctl</span><span class="p">,</span> <span class="n">unit</span><span class="p">])</span>
+                                  
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_hint</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Fill the sizer containing hint </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;We support omf, sld or pdb data files only.&quot;</span>
+        <span class="n">hint_msg</span> <span class="o">+=</span>  <span class="s">&quot;         &quot;</span>
+        <span class="k">if</span> <span class="n">FONT_VARIANT</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="n">hint_msg</span> <span class="o">+=</span>  <span class="s">&quot;Very &quot;</span>
+        <span class="n">hint_msg</span> <span class="o">+=</span> <span class="s">&quot;SLOW drawing --&gt;&quot;</span>
+        <span class="n">hint_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">hint_msg</span><span class="p">)</span>
+        
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Arrow Draw&quot;</span><span class="p">)</span>
+        <span class="n">hint_on_draw</span> <span class="o">=</span> <span class="s">&quot;Draw with arrows. Caution: it is a very slow drawing.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_on_draw</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_button</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_draw</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">hint_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">draw_button</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">LEFT</span><span class="p">,</span> <span class="mi">7</span><span class="p">)])</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_shape</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the shape sizer</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">label_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Shape:&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">shape_combo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fill_shape_combo</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">shape_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">label_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">shape_combo</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+    
+    <span class="k">def</span> <span class="nf">_fill_shape_combo</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill up the shape combo box</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">shape_combo</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">150</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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> 
+        <span class="n">shape_combo</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;Rectangular&#39;</span><span class="p">)</span>
+        <span class="n">shape_combo</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;Ellipsoid&#39;</span><span class="p">)</span>
+        <span class="n">shape_combo</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_shape_select</span><span class="p">)</span>
+        <span class="n">shape_combo</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">shape_combo</span>
+    
+    <span class="k">def</span> <span class="nf">_on_shape_select</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On selecting a shape</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">label</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">default_shape</span> <span class="o">=</span> <span class="n">label</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_omfpanel_default_shap</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">default_shape</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_omfpanel_npts</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_fill_orient_combo</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill up the orientation combo box: used only for atomic structure</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">orient_combo</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">150</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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> 
+        <span class="n">orient_combo</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;Fixed orientation&#39;</span><span class="p">)</span>
+        <span class="n">orient_combo</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;Debye full avg.&#39;</span><span class="p">)</span>
+        <span class="c">#orient_combo.Append(&#39;Debye sph. sym.&#39;)</span>
+        
+        <span class="n">orient_combo</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_orient_select</span><span class="p">)</span>
+        <span class="n">orient_combo</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">orient_combo</span>
+    
+    <span class="k">def</span> <span class="nf">_on_orient_select</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On selecting a orientation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">cb</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">cb</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">is_avg</span> <span class="o">=</span> <span class="n">cb</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span> <span class="o">==</span> <span class="mi">1</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span> <span class="o">=</span> <span class="n">is_avg</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_is_avg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_est_time</span><span class="p">()</span>    
+           
+    <span class="k">def</span> <span class="nf">_layout_qrange</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing qrange</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">#key_list.sort()</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;No. of Qx (Qy) bins: &#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                        <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="c">## add parameter value</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npt_ctl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">*</span> <span class="mf">1.5</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                            <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npt_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onparamEnter</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npt_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span><span class="p">,</span> <span class="bp">True</span><span class="p">))</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npt_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+        <span class="c">## add unit</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                        <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Qx (Qy) Max: &#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                        <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="c">## add parameter value</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">*</span> <span class="mf">1.5</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                            <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onparamEnter</span> <span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">,</span> <span class="bp">True</span><span class="p">))</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+        <span class="c">## add unit</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[1/A]&#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                        <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qrange_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">est_time</span> <span class="o">=</span> <span class="s">&#39;*Estimated Computation time :</span><span class="se">\n</span><span class="s">  </span><span class="si">%s</span><span class="s">&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">time_text</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">est_time</span><span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="s">&#39;2 sec&#39;</span><span class="p">)</span> <span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orient_combo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fill_orient_combo</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orient_combo</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_compute</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span><span class="s">&#39;Compute&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_compute</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_compute</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_compute</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Compute 2D Scattering Pattern.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">time_text</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orient_combo</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">LEFT</span><span class="p">,</span> <span class="mi">40</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_compute</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">)])</span>
+        
+<div class="viewcode-block" id="SasGenPanel.estimate_ctime"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.estimate_ctime">[docs]</a>    <span class="k">def</span> <span class="nf">estimate_ctime</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Calculation time estimation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># magic equation: not very accurate</span>
+        <span class="n">factor</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="n">n_qbins</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npt_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="n">n_qbins</span> <span class="o">*=</span> <span class="n">n_qbins</span>
+        <span class="n">n_pixs</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_npix</span><span class="p">())</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span><span class="p">:</span>
+            <span class="n">factor</span> <span class="o">=</span> <span class="mi">6</span>
+            <span class="n">n_pixs</span> <span class="o">*=</span> <span class="p">(</span><span class="n">n_pixs</span> <span class="o">/</span> <span class="mi">200</span><span class="p">)</span>
+        <span class="n">x_in</span> <span class="o">=</span> <span class="n">n_qbins</span> <span class="o">*</span> <span class="n">n_pixs</span> <span class="o">/</span> <span class="mi">100000</span>
+        <span class="n">etime</span> <span class="o">=</span> <span class="n">factor</span> <span class="o">+</span> <span class="mf">0.085973</span> <span class="o">*</span> <span class="n">x_in</span> 
+        <span class="k">return</span> <span class="nb">int</span><span class="p">(</span><span class="n">etime</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="SasGenPanel.set_est_time"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.set_est_time">[docs]</a>    <span class="k">def</span> <span class="nf">set_est_time</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set text for est. computation time</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="s">&#39;sec&#39;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_text</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">time_text</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;black&#39;</span><span class="p">)</span>
+            <span class="n">etime</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">estimate_ctime</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">etime</span> <span class="o">&gt;</span> <span class="mi">60</span><span class="p">:</span>
+                <span class="n">etime</span> <span class="o">/=</span> <span class="mi">60</span>
+                <span class="n">unit</span> <span class="o">=</span> <span class="s">&#39;min&#39;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">time_text</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;red&#39;</span><span class="p">)</span>
+            <span class="n">time_str</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">etime</span><span class="p">)</span> <span class="o">+</span> <span class="s">&#39; &#39;</span> <span class="o">+</span> <span class="n">unit</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">time_text</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">est_time</span><span class="o">%</span> <span class="n">time_str</span><span class="p">)</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw window content</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_data_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_param_size</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_qrange</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_hint</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_shape</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">shape_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_parameters</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">param_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_qrange</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">qrange_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_parameters</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_qrange</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_create_default_sld_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Making default sld-data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">sld_n_default</span> <span class="o">=</span> <span class="mf">6.97e-06</span>
+        <span class="n">omfdata</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">OMFData</span><span class="p">()</span>
+        <span class="n">omf2sld</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">OMF2SLD</span><span class="p">()</span>
+        <span class="n">omf2sld</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">omfdata</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">default_shape</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="n">omf2sld</span><span class="o">.</span><span class="n">output</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="s">&quot;Default SLD Profile&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">set_sldn</span><span class="p">(</span><span class="n">sld_n_default</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">filename</span><span class="p">)</span>       
+               
+<div class="viewcode-block" id="SasGenPanel.choose_data_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.choose_data_file">[docs]</a>    <span class="k">def</span> <span class="nf">choose_data_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Choosing a dtata file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">filename</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="k">if</span> <span class="n">location</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>
+
+        <span class="n">exts</span> <span class="o">=</span> <span class="s">&quot;*&quot;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">omfreader</span><span class="o">.</span><span class="n">ext</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">exts</span> <span class="o">+=</span> <span class="s">&quot;, *&quot;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">sldreader</span><span class="o">.</span><span class="n">ext</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">exts</span> <span class="o">+=</span> <span class="s">&quot;, *&quot;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">pdbreader</span><span class="o">.</span><span class="n">ext</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">all_type</span> <span class="o">=</span> <span class="s">&quot;All GEN files (</span><span class="si">%s</span><span class="s">, </span><span class="si">%s</span><span class="s">) | </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="n">exts</span><span class="o">.</span><span class="n">upper</span><span class="p">(),</span> <span class="n">exts</span><span class="o">.</span><span class="n">lower</span><span class="p">(),</span> 
+                                               <span class="n">exts</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">.</span><span class="n">replace</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>        
+        <span class="n">wildcard</span> <span class="o">=</span> <span class="p">[</span><span class="n">all_type</span><span class="p">]</span>
+        <span class="n">omf_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">omfreader</span><span class="o">.</span><span class="n">type</span>
+        <span class="n">sld_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sldreader</span><span class="o">.</span><span class="n">type</span>
+        <span class="n">pdb_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pdbreader</span><span class="o">.</span><span class="n">type</span>
+
+        <span class="k">for</span> <span class="nb">type</span> <span class="ow">in</span> <span class="n">sld_type</span><span class="p">:</span>
+            <span class="n">wildcard</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">type</span><span class="p">)</span>
+        <span class="k">for</span> <span class="nb">type</span> <span class="ow">in</span> <span class="n">omf_type</span><span class="p">:</span>
+            <span class="n">wildcard</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">type</span><span class="p">)</span>
+        <span class="k">for</span> <span class="nb">type</span> <span class="ow">in</span> <span class="n">pdb_type</span><span class="p">:</span>
+            <span class="n">wildcard</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">type</span><span class="p">)</span>
+        <span class="n">wildcard</span> <span class="o">=</span> <span class="s">&#39;|&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">wildcard</span><span class="p">)</span>
+        <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="bp">self</span><span class="p">,</span> <span class="s">&quot;Choose a file&quot;</span><span class="p">,</span> <span class="n">location</span><span class="p">,</span>
+                            <span class="s">&quot;&quot;</span><span class="p">,</span> <span class="n">wildcard</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">OPEN</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+            <span class="n">filename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span> 
+        <span class="k">return</span> <span class="n">path</span>
+        </div>
+<div class="viewcode-block" id="SasGenPanel.on_load_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.on_load_data">[docs]</a>    <span class="k">def</span> <span class="nf">on_load_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Open a file dialog to allow the user to select a given file.</span>
+<span class="sd">        The user is only allow to load file with extension .omf, .txt, .sld.</span>
+<span class="sd">        Display the slit size corresponding to the loaded data.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">location</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_path</span><span class="p">()</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">choose_data_file</span><span class="p">(</span><span class="n">location</span><span class="o">=</span><span class="n">location</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">path</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">shape_sizer</span><span class="o">.</span><span class="n">ShowItems</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">default_shape</span> <span class="o">=</span> <span class="s">&#39;rectangular&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_omfpanel_default_shap</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">default_shape</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_file_location</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">path</span><span class="p">))</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c">#Load data</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">path</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">omfreader</span><span class="o">.</span><span class="n">ext</span><span class="p">:</span>
+                <span class="n">loader</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">omfreader</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">sldreader</span><span class="o">.</span><span class="n">ext</span><span class="p">:</span>
+                <span class="n">loader</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sldreader</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">pdbreader</span><span class="o">.</span><span class="n">ext</span><span class="p">:</span>
+                <span class="n">loader</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pdbreader</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">loader</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">browse_button</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">browse_button</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;Loading...&quot;</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                                <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Loading...&quot;</span><span class="p">,</span>
+                                <span class="nb">type</span><span class="o">=</span><span class="s">&quot;progress&quot;</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="n">GenReader</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> <span class="n">loader</span><span class="o">=</span><span class="n">loader</span><span class="p">,</span>
+                                    <span class="n">completefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">complete_loading</span><span class="p">,</span>
+                                    <span class="n">updatefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">load_update</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>
+            <span class="c">#self.load_update()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span> 
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Generic SAS Calculator: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                          <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&#39;stop&#39;</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+            <span class="k">return</span> 
+        </div>
+<div class="viewcode-block" id="SasGenPanel.load_update"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.load_update">[docs]</a>    <span class="k">def</span> <span class="nf">load_update</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        print update on the status bar</span>
+<span class="sd">        &quot;&quot;&quot;</span>       
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span> 
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+            <span class="nb">type</span> <span class="o">=</span> <span class="s">&quot;progress&quot;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="nb">type</span> <span class="o">=</span> <span class="s">&quot;stop&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;&quot;</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="nb">type</span><span class="p">))</span>
+            </div>
+<div class="viewcode-block" id="SasGenPanel.complete_loading"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.complete_loading">[docs]</a>    <span class="k">def</span> <span class="nf">complete_loading</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Complete the loading</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#compute the slit size</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">browse_button</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">browse_button</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&#39;Load&#39;</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">is_pdbdata</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="n">filename</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">filename</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">filename</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">file_name</span> <span class="o">=</span> <span class="n">filename</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">orient_combo</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">omfreader</span><span class="o">.</span><span class="n">ext</span><span class="p">:</span>
+                <span class="n">gen</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">OMF2SLD</span><span class="p">()</span>
+                <span class="n">gen</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+                <span class="c">#omf_data = data</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="n">gen</span><span class="o">.</span><span class="n">get_magsld</span><span class="p">()</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">sldreader</span><span class="o">.</span><span class="n">ext</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="n">data</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">pdbreader</span><span class="o">.</span><span class="n">ext</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="n">data</span>
+                <span class="n">is_pdbdata</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="c">#omf_data = None</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">raise</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">orient_combo</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="n">is_pdbdata</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_sld_data_helper</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">raise</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Loading Error: This file format is not supported &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;for GenSAS.&quot;</span> 
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                          <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&#39;stop&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;Error&#39;</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+            <span class="k">return</span> 
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Load Complete&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&#39;stop&#39;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_set_sld_data_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">is_draw</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set sld data helper</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#is_avg = self.orient_combo.GetCurrentSelection() == 1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_is_avg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_sld_data</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">!=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_sld_data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_update_model_params</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">is_draw</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_draw</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">False</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_update_model_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Update the model parameter values</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="nb">list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+            <span class="n">param_name</span> <span class="o">=</span> <span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetLabelText</span><span class="p">()</span>
+            <span class="n">val</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="n">param_name</span><span class="p">])</span>
+            <span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="SasGenPanel.set_volume_ctl_val"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.set_volume_ctl_val">[docs]</a>    <span class="k">def</span> <span class="nf">set_volume_ctl_val</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">val</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set volume txtctrl value</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="nb">list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+            <span class="n">param_name</span> <span class="o">=</span> <span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetLabelText</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">param_name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;total_volume&#39;</span><span class="p">:</span>
+                <span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+                <span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="k">break</span>
+                            </div>
+    <span class="k">def</span> <span class="nf">_onparamEnter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On param enter</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">item</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_check_value</span><span class="p">()</span>
+            <span class="n">item</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+    
+<div class="viewcode-block" id="SasGenPanel.sld_draw"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.sld_draw">[docs]</a>    <span class="k">def</span> <span class="nf">sld_draw</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">has_arrow</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw 3D sld profile</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">check_omfpanel_inputs</span><span class="p">()</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">infor</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;Error: Wrong inputs in the SLD info panel.&#39;</span>
+            <span class="c"># inform msg to wx</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                    <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="n">infor</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+            <span class="k">return</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_sld_from_omf</span><span class="p">()</span>
+        <span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span>  
+        <span class="c">#frame_size = wx.Size(470, 470)    </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot_frame</span> <span class="o">=</span> <span class="n">PlotFrame</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;testView&#39;</span><span class="p">)</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_frame</span>
+        <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">add_icon</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">frame</span><span class="p">)</span>
+        <span class="n">panel</span> <span class="o">=</span> <span class="n">frame</span><span class="o">.</span><span class="n">plotpanel</span>    
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># mpl &gt;= 1.0.0</span>
+            <span class="n">ax</span> <span class="o">=</span> <span class="n">panel</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">gca</span><span class="p">(</span><span class="n">projection</span><span class="o">=</span><span class="s">&#39;3d&#39;</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c"># mpl &lt; 1.0.0</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="kn">from</span> <span class="nn">mpl_toolkits.mplot3d</span> <span class="kn">import</span> <span class="n">Axes3D</span>
+                <span class="n">ax</span> <span class="o">=</span> <span class="n">Axes3D</span><span class="p">(</span><span class="n">panel</span><span class="o">.</span><span class="n">figure</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;PlotPanel could not import Axes3D&quot;</span><span class="p">)</span>
+                <span class="k">raise</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">dimension</span> <span class="o">=</span> <span class="mi">3</span>   
+        <span class="n">graph_title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sld_plot_helper</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="n">output</span><span class="p">,</span> <span class="n">has_arrow</span><span class="p">)</span>
+        <span class="c"># Use y, z axes (in mpl 3d) as z, y axes </span>
+        <span class="c"># that consistent with our SAS detector coords.</span>
+        <span class="n">ax</span><span class="o">.</span><span class="n">set_xlabel</span><span class="p">(</span><span class="s">&#39;x ($\A</span><span class="si">%s</span><span class="s">$)&#39;</span><span class="o">%</span> <span class="n">output</span><span class="o">.</span><span class="n">pos_unit</span><span class="p">)</span>
+        <span class="n">ax</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s">&#39;z ($\A</span><span class="si">%s</span><span class="s">$)&#39;</span><span class="o">%</span> <span class="n">output</span><span class="o">.</span><span class="n">pos_unit</span><span class="p">)</span>
+        <span class="n">ax</span><span class="o">.</span><span class="n">set_zlabel</span><span class="p">(</span><span class="s">&#39;y ($\A</span><span class="si">%s</span><span class="s">$)&#39;</span><span class="o">%</span> <span class="n">output</span><span class="o">.</span><span class="n">pos_unit</span><span class="p">)</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">subplots_adjust</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="mf">0.05</span><span class="p">,</span> <span class="n">right</span><span class="o">=</span><span class="mf">0.95</span><span class="p">,</span> 
+                                             <span class="n">bottom</span><span class="o">=</span><span class="mf">0.05</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.96</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">output</span><span class="o">.</span><span class="n">pix_type</span> <span class="o">==</span> <span class="s">&#39;atom&#39;</span><span class="p">:</span>
+            <span class="n">ax</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s">&#39;upper left&#39;</span><span class="p">,</span> <span class="n">prop</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;size&#39;</span><span class="p">:</span><span class="mi">10</span><span class="p">})</span>
+        <span class="n">num_graph</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_num</span><span class="p">)</span>
+        <span class="n">frame</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="s">&#39;Graph </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&#39;</span><span class="o">%</span> <span class="p">(</span><span class="n">num_graph</span><span class="p">,</span> <span class="n">graph_title</span><span class="p">))</span>        
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">,</span> <span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph_num</span> <span class="o">+=</span> <span class="mi">1</span>
+</div>
+    <span class="k">def</span> <span class="nf">_sld_plot_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ax</span><span class="p">,</span> <span class="n">output</span><span class="p">,</span> <span class="n">has_arrow</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Actual plot definition happens here</span>
+<span class="sd">        :Param ax: axis3d</span>
+<span class="sd">        :Param output: sld_data [MagSLD]</span>
+<span class="sd">        :Param has_arrow: whether or not draws M vector [bool]</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Set the locals</span>
+        <span class="n">color_dic</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;H&#39;</span><span class="p">:</span><span class="s">&#39;blue&#39;</span><span class="p">,</span> <span class="s">&#39;D&#39;</span><span class="p">:</span><span class="s">&#39;purple&#39;</span><span class="p">,</span> <span class="s">&#39;N&#39;</span><span class="p">:</span> <span class="s">&#39;orange&#39;</span><span class="p">,</span> 
+                     <span class="s">&#39;O&#39;</span><span class="p">:</span><span class="s">&#39;red&#39;</span><span class="p">,</span> <span class="s">&#39;C&#39;</span><span class="p">:</span><span class="s">&#39;green&#39;</span><span class="p">,</span> <span class="s">&#39;P&#39;</span><span class="p">:</span><span class="s">&#39;cyan&#39;</span><span class="p">,</span> <span class="s">&#39;Other&#39;</span><span class="p">:</span><span class="s">&#39;k&#39;</span><span class="p">}</span>
+        <span class="n">marker</span> <span class="o">=</span> <span class="s">&#39;,&#39;</span>
+        <span class="n">m_size</span> <span class="o">=</span> <span class="mi">2</span>
+        <span class="n">graph_title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">file_name</span>
+        <span class="n">graph_title</span> <span class="o">+=</span> <span class="s">&quot;   3D SLD Profile &quot;</span>
+        <span class="n">pos_x</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">pos_x</span>
+        <span class="n">pos_y</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">pos_y</span>
+        <span class="n">pos_z</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">pos_z</span>
+        <span class="n">sld_mx</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">sld_mx</span>
+        <span class="n">sld_my</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">sld_my</span>
+        <span class="n">sld_mz</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">sld_mz</span> 
+        <span class="n">pix_symbol</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">pix_symbol</span> 
+        <span class="k">if</span> <span class="n">output</span><span class="o">.</span><span class="n">pix_type</span> <span class="o">==</span> <span class="s">&#39;atom&#39;</span><span class="p">:</span>
+            <span class="n">marker</span> <span class="o">=</span> <span class="s">&#39;o&#39;</span>
+            <span class="n">m_size</span> <span class="o">=</span> <span class="mf">3.5</span>
+        <span class="n">sld_tot</span> <span class="o">=</span> <span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">sld_mx</span><span class="p">)</span> <span class="o">+</span> <span class="n">numpy</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">sld_my</span><span class="p">)</span> <span class="o">+</span> \
+                   <span class="n">numpy</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">sld_mz</span><span class="p">)</span> <span class="o">+</span> <span class="n">numpy</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">sld_n</span><span class="p">))</span>
+        <span class="n">is_nonzero</span> <span class="o">=</span> <span class="n">sld_tot</span> <span class="o">&gt;</span> <span class="mf">0.0</span>  
+        <span class="n">is_zero</span> <span class="o">=</span> <span class="n">sld_tot</span> <span class="o">==</span> <span class="mf">0.0</span>   
+        <span class="c"># I. Plot null points</span>
+        <span class="k">if</span> <span class="n">is_zero</span><span class="o">.</span><span class="n">any</span><span class="p">():</span>
+            <span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pos_x</span><span class="p">[</span><span class="n">is_zero</span><span class="p">],</span> <span class="n">pos_z</span><span class="p">[</span><span class="n">is_zero</span><span class="p">],</span> <span class="n">pos_y</span><span class="p">[</span><span class="n">is_zero</span><span class="p">],</span> <span class="n">marker</span><span class="p">,</span> 
+                    <span class="n">c</span><span class="o">=</span><span class="s">&quot;y&quot;</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> <span class="n">markeredgecolor</span><span class="o">=</span><span class="s">&#39;y&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="n">m_size</span><span class="p">)</span> 
+            <span class="n">pos_x</span> <span class="o">=</span> <span class="n">pos_x</span><span class="p">[</span><span class="n">is_nonzero</span><span class="p">]</span>
+            <span class="n">pos_y</span> <span class="o">=</span> <span class="n">pos_y</span><span class="p">[</span><span class="n">is_nonzero</span><span class="p">]</span>
+            <span class="n">pos_z</span> <span class="o">=</span> <span class="n">pos_z</span><span class="p">[</span><span class="n">is_nonzero</span><span class="p">]</span>
+            <span class="n">sld_mx</span> <span class="o">=</span> <span class="n">sld_mx</span><span class="p">[</span><span class="n">is_nonzero</span><span class="p">]</span>
+            <span class="n">sld_my</span> <span class="o">=</span> <span class="n">sld_my</span><span class="p">[</span><span class="n">is_nonzero</span><span class="p">]</span>
+            <span class="n">sld_mz</span> <span class="o">=</span> <span class="n">sld_mz</span><span class="p">[</span><span class="n">is_nonzero</span><span class="p">]</span>
+            <span class="n">pix_symbol</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">pix_symbol</span><span class="p">[</span><span class="n">is_nonzero</span><span class="p">]</span>
+        <span class="c"># II. Plot selective points in color</span>
+        <span class="n">other_color</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">pix_symbol</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="s">&#39;bool&#39;</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">color_dic</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="n">chosen_color</span> <span class="o">=</span> <span class="n">pix_symbol</span> <span class="o">==</span> <span class="n">key</span>
+            <span class="k">if</span> <span class="n">numpy</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">chosen_color</span><span class="p">):</span>
+                <span class="n">other_color</span> <span class="o">=</span> <span class="n">other_color</span>  <span class="o">&amp;</span> <span class="p">(</span><span class="n">chosen_color</span> <span class="o">!=</span> <span class="bp">True</span><span class="p">)</span>
+                <span class="n">color</span> <span class="o">=</span> <span class="n">color_dic</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
+                <span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pos_x</span><span class="p">[</span><span class="n">chosen_color</span><span class="p">],</span> <span class="n">pos_z</span><span class="p">[</span><span class="n">chosen_color</span><span class="p">],</span> 
+                        <span class="n">pos_y</span><span class="p">[</span><span class="n">chosen_color</span><span class="p">],</span> <span class="n">marker</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="n">color</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> 
+                        <span class="n">markeredgecolor</span><span class="o">=</span><span class="n">color</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="n">m_size</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="n">key</span><span class="p">)</span> 
+        <span class="c"># III. Plot All others        </span>
+        <span class="k">if</span> <span class="n">numpy</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">other_color</span><span class="p">):</span>
+            <span class="n">a_name</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+            <span class="k">if</span> <span class="n">output</span><span class="o">.</span><span class="n">pix_type</span> <span class="o">==</span> <span class="s">&#39;atom&#39;</span><span class="p">:</span>
+                <span class="c"># Get atom names not in the list</span>
+                <span class="n">a_names</span> <span class="o">=</span> <span class="p">[</span><span class="n">symb</span>  <span class="k">for</span> <span class="n">symb</span> <span class="ow">in</span> <span class="n">pix_symbol</span> \
+                           <span class="k">if</span> <span class="n">symb</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">color_dic</span><span class="o">.</span><span class="n">keys</span><span class="p">()]</span>
+                <span class="n">a_name</span> <span class="o">=</span> <span class="n">a_names</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">a_names</span><span class="p">:</span>
+                    <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;, &quot;</span> <span class="o">+</span> <span class="n">name</span>
+                    <span class="k">if</span> <span class="n">a_name</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">a_name</span> <span class="o">+=</span> <span class="n">new_name</span>
+            <span class="c"># plot in black</span>
+            <span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pos_x</span><span class="p">[</span><span class="n">other_color</span><span class="p">],</span> <span class="n">pos_z</span><span class="p">[</span><span class="n">other_color</span><span class="p">],</span> <span class="n">pos_y</span><span class="p">[</span><span class="n">other_color</span><span class="p">],</span> 
+                    <span class="n">marker</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="s">&quot;k&quot;</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> <span class="n">markeredgecolor</span><span class="o">=</span><span class="s">&quot;k&quot;</span><span class="p">,</span> 
+                    <span class="n">markersize</span><span class="o">=</span><span class="n">m_size</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="n">a_name</span><span class="p">)</span> 
+        <span class="c"># IV. Draws atomic bond with grey lines if any</span>
+        <span class="k">if</span> <span class="n">output</span><span class="o">.</span><span class="n">has_conect</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">line_x</span><span class="p">)):</span>
+                <span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">line_x</span><span class="p">[</span><span class="n">ind</span><span class="p">],</span> <span class="n">output</span><span class="o">.</span><span class="n">line_z</span><span class="p">[</span><span class="n">ind</span><span class="p">],</span> 
+                        <span class="n">output</span><span class="o">.</span><span class="n">line_y</span><span class="p">[</span><span class="n">ind</span><span class="p">],</span> <span class="s">&#39;-&#39;</span><span class="p">,</span> <span class="n">lw</span><span class="o">=</span><span class="mf">0.6</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="s">&quot;grey&quot;</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span> 
+        <span class="c"># V. Draws magnetic vectors</span>
+        <span class="k">if</span> <span class="n">has_arrow</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">pos_x</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>     
+            <span class="n">graph_title</span> <span class="o">+=</span> <span class="s">&quot; - Magnetic Vector as Arrow -&quot;</span> 
+            <span class="n">panel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_frame</span><span class="o">.</span><span class="n">plotpanel</span>
+            <span class="k">def</span> <span class="nf">_draw_arrow</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+                <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">                draw magnetic vectors w/arrow</span>
+<span class="sd">                &quot;&quot;&quot;</span>
+                <span class="n">max_mx</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">sld_mx</span><span class="p">))</span>
+                <span class="n">max_my</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">sld_my</span><span class="p">))</span>
+                <span class="n">max_mz</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">sld_mz</span><span class="p">))</span>
+                <span class="n">max_m</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">max_mx</span><span class="p">,</span> <span class="n">max_my</span><span class="p">,</span> <span class="n">max_mz</span><span class="p">)</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">max_step</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">output</span><span class="o">.</span><span class="n">xstepsize</span><span class="p">,</span> <span class="n">output</span><span class="o">.</span><span class="n">ystepsize</span><span class="p">,</span> 
+                                   <span class="n">output</span><span class="o">.</span><span class="n">zstepsize</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">max_step</span> <span class="o">=</span> <span class="mi">0</span>
+                <span class="k">if</span> <span class="n">max_step</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="n">max_step</span> <span class="o">=</span> <span class="mi">5</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">max_m</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">unit_x2</span> <span class="o">=</span> <span class="n">sld_mx</span> <span class="o">/</span> <span class="n">max_m</span>
+                        <span class="n">unit_y2</span> <span class="o">=</span> <span class="n">sld_my</span> <span class="o">/</span> <span class="n">max_m</span>
+                        <span class="n">unit_z2</span> <span class="o">=</span> <span class="n">sld_mz</span> <span class="o">/</span> <span class="n">max_m</span>
+                        <span class="c"># 0.8 is for avoiding the color becomes white=(1,1,1))</span>
+                        <span class="n">color_x</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">unit_x2</span> <span class="o">*</span> <span class="mf">0.8</span><span class="p">)</span>
+                        <span class="n">color_y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">unit_y2</span> <span class="o">*</span> <span class="mf">0.8</span><span class="p">)</span>
+                        <span class="n">color_z</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">unit_z2</span> <span class="o">*</span> <span class="mf">0.8</span><span class="p">)</span>
+                        <span class="n">x2</span> <span class="o">=</span> <span class="n">pos_x</span> <span class="o">+</span> <span class="n">unit_x2</span> <span class="o">*</span> <span class="n">max_step</span>
+                        <span class="n">y2</span> <span class="o">=</span> <span class="n">pos_y</span> <span class="o">+</span> <span class="n">unit_y2</span> <span class="o">*</span> <span class="n">max_step</span>
+                        <span class="n">z2</span> <span class="o">=</span> <span class="n">pos_z</span> <span class="o">+</span> <span class="n">unit_z2</span> <span class="o">*</span> <span class="n">max_step</span>
+                        <span class="n">x_arrow</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">column_stack</span><span class="p">((</span><span class="n">pos_x</span><span class="p">,</span> <span class="n">x2</span><span class="p">))</span>
+                        <span class="n">y_arrow</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">column_stack</span><span class="p">((</span><span class="n">pos_y</span><span class="p">,</span> <span class="n">y2</span><span class="p">))</span>
+                        <span class="n">z_arrow</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">column_stack</span><span class="p">((</span><span class="n">pos_z</span><span class="p">,</span> <span class="n">z2</span><span class="p">))</span>
+                        <span class="n">colors</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">column_stack</span><span class="p">((</span><span class="n">color_x</span><span class="p">,</span> <span class="n">color_y</span><span class="p">,</span> <span class="n">color_z</span><span class="p">))</span>
+                        <span class="n">arrows</span> <span class="o">=</span> <span class="n">Arrow3D</span><span class="p">(</span><span class="n">panel</span><span class="p">,</span> <span class="n">x_arrow</span><span class="p">,</span> <span class="n">z_arrow</span><span class="p">,</span> <span class="n">y_arrow</span><span class="p">,</span> 
+                                        <span class="n">colors</span><span class="p">,</span> <span class="n">mutation_scale</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">lw</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> 
+                                        <span class="n">arrowstyle</span><span class="o">=</span><span class="s">&quot;-&gt;&quot;</span><span class="p">,</span> <span class="n">alpha</span> <span class="o">=</span> <span class="mf">0.5</span><span class="p">)</span>
+                        <span class="n">ax</span><span class="o">.</span><span class="n">add_artist</span><span class="p">(</span><span class="n">arrows</span><span class="p">)</span> 
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span> 
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Arrow Drawing completed.</span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">status_type</span> <span class="o">=</span> <span class="s">&#39;stop&#39;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">status_type</span><span class="p">)</span> 
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Arrow Drawing is in progress...&quot;</span>
+            <span class="n">status_type</span> <span class="o">=</span> <span class="s">&#39;progress&#39;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">status_type</span><span class="p">)</span> 
+            <span class="n">draw_out</span> <span class="o">=</span> <span class="n">CalcGen</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">ax</span><span class="p">,</span>
+                             <span class="n">completefn</span><span class="o">=</span><span class="n">_draw_arrow</span><span class="p">,</span> <span class="n">updatefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_update</span><span class="p">)</span>
+            <span class="n">draw_out</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">graph_title</span>
+ 
+<div class="viewcode-block" id="SasGenPanel.set_input_params"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.set_input_params">[docs]</a>    <span class="k">def</span> <span class="nf">set_input_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set model parameters</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="nb">list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+            <span class="n">param_name</span> <span class="o">=</span> <span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetLabelText</span><span class="p">()</span>
+            <span class="n">param_value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">param_name</span><span class="p">,</span> <span class="n">param_value</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="SasGenPanel.on_compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.on_compute">[docs]</a>    <span class="k">def</span> <span class="nf">on_compute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Compute I(qx, qy)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">check_omfpanel_inputs</span><span class="p">()</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">infor</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;Error: Wrong inputs in the SLD info panel.&#39;</span>
+            <span class="c"># inform msg to wx</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                    <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="n">infor</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_sld_from_omf</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">infor</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;Error: No data has been selected.&#39;</span>
+                <span class="c"># inform msg to wx</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                        <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="n">infor</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+            <span class="k">return</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_value</span><span class="p">()</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">_set_error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">True</span><span class="p">)</span>
+            <span class="k">return</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_sld_data</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_input_params</span><span class="p">()</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_create_default_1d_data</span><span class="p">()</span>
+                <span class="n">i_out</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">y</span><span class="p">))</span>
+                <span class="n">inputs</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="p">[],</span> <span class="n">i_out</span><span class="p">]</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_create_default_2d_data</span><span class="p">()</span>
+                <span class="n">i_out</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">data</span><span class="p">))</span>
+                <span class="n">inputs</span><span class="o">=</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qy_data</span><span class="p">,</span> <span class="n">i_out</span><span class="p">]</span>
+                
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Computation is in progress...&quot;</span>
+            <span class="n">status_type</span> <span class="o">=</span> <span class="s">&#39;progress&#39;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">status_type</span><span class="p">)</span>
+            <span class="n">cal_out</span> <span class="o">=</span> <span class="n">CalcGen</span><span class="p">(</span><span class="nb">input</span><span class="o">=</span><span class="n">inputs</span><span class="p">,</span> 
+                              <span class="n">completefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">,</span> 
+                              <span class="n">updatefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_update</span><span class="p">)</span>
+            <span class="n">cal_out</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>              
+            
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">.&quot;</span><span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">status_type</span> <span class="o">=</span> <span class="s">&#39;stop&#39;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">status_type</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                        <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;Error&#39;</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+</div>
+    <span class="k">def</span> <span class="nf">_check_value</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check input values if float</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npt_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">npt_val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npt_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>  
+            <span class="k">if</span> <span class="n">npt_val</span> <span class="o">&lt;</span> <span class="mi">2</span> <span class="ow">or</span> <span class="n">npt_val</span> <span class="o">&gt;</span> <span class="mi">1000</span><span class="p">:</span>
+                <span class="k">raise</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npt_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">npt_val</span><span class="p">)))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_est_time</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span>  <span class="n">_set_error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">npt_ctl</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">qmax_val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span> 
+            <span class="k">if</span> <span class="n">qmax_val</span> <span class="o">&lt;=</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">qmax_val</span> <span class="o">&gt;</span> <span class="mi">1000</span><span class="p">:</span>
+                <span class="k">raise</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="n">_set_error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="p">)</span>       
+        <span class="k">for</span> <span class="nb">list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+            <span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+            <span class="n">param_name</span> <span class="o">=</span> <span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetLabelText</span><span class="p">()</span>
+            <span class="k">try</span><span class="p">:</span> 
+                <span class="n">param_val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                <span class="k">if</span> <span class="n">param_name</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;frac&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">param_val</span> <span class="o">&lt;</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">param_val</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                       <span class="k">raise</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="n">_set_error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="k">return</span> <span class="n">flag</span>
+                   
+    <span class="k">def</span> <span class="nf">_status_info</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;&#39;</span><span class="p">,</span> <span class="nb">type</span> <span class="o">=</span> <span class="s">&quot;update&quot;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Status msg</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">type</span> <span class="o">==</span> <span class="s">&quot;stop&quot;</span><span class="p">:</span>
+            <span class="n">label</span> <span class="o">=</span> <span class="s">&quot;Compute&quot;</span>
+            <span class="n">able</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">else</span><span class="p">:</span>   
+            <span class="n">label</span> <span class="o">=</span> <span class="s">&quot;Wait...&quot;</span>
+            <span class="n">able</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_compute</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="n">able</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_compute</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">label</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_compute</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">label</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                             <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span> <span class="o">=</span> <span class="n">msg</span><span class="p">,</span> <span class="nb">type</span> <span class="o">=</span> <span class="nb">type</span> <span class="p">))</span> 
+
+    <span class="k">def</span> <span class="nf">_update</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">time</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Update the progress bar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="nb">type</span> <span class="o">=</span> <span class="s">&quot;progress&quot;</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please wait. Computing... (Note: Window may look frozen.)&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="nb">type</span><span class="p">))</span>
+                                
+<div class="viewcode-block" id="SasGenPanel.complete"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.complete">[docs]</a>    <span class="k">def</span> <span class="nf">complete</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">input</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>   
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Gen compute complete function</span>
+<span class="sd">        :Param input: input list [qx_data, qy_data, i_out]</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">out</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">empty</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="c">#s = time.time()</span>
+        <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="nb">input</span><span class="p">[</span><span class="mi">0</span><span class="p">])):</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">ind</span> <span class="o">%</span> <span class="mi">1</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">update</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">update</span><span class="p">()</span>
+                    <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.1</span><span class="p">)</span>
+                <span class="n">inputi</span> <span class="o">=</span> <span class="p">[</span><span class="nb">input</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">ind</span><span class="p">:</span><span class="n">ind</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span> <span class="p">[],</span> <span class="nb">input</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="n">ind</span><span class="p">:</span><span class="n">ind</span><span class="o">+</span><span class="mi">1</span><span class="p">]]</span>
+                <span class="n">outi</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">inputi</span><span class="p">)</span>
+                <span class="n">out</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">outi</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">ind</span> <span class="o">%</span> <span class="mi">50</span> <span class="o">==</span> <span class="mi">0</span>  <span class="ow">and</span> <span class="n">update</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">update</span><span class="p">()</span>
+                    <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.001</span><span class="p">)</span>
+                <span class="n">inputi</span> <span class="o">=</span> <span class="p">[</span><span class="nb">input</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">ind</span><span class="p">:</span><span class="n">ind</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span> <span class="nb">input</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="n">ind</span><span class="p">:</span><span class="n">ind</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span> 
+                          <span class="nb">input</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="n">ind</span><span class="p">:</span><span class="n">ind</span><span class="o">+</span><span class="mi">1</span><span class="p">]]</span>
+                <span class="n">outi</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="n">inputi</span><span class="p">)</span>
+                <span class="n">out</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">outi</span><span class="p">)</span>
+        <span class="c">#print time.time() - s</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_avg</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_draw1D</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c">#out = self.model.runXY(input)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_draw2D</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
+            
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Gen computation completed.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">status_type</span> <span class="o">=</span> <span class="s">&#39;stop&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">status_type</span><span class="p">)</span>
+               </div>
+    <span class="k">def</span> <span class="nf">_create_default_2d_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create 2D data by default</span>
+<span class="sd">        Only when the page is on theory mode.</span>
+<span class="sd">        :warning: This data is never plotted.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npt_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">Data2D</span><span class="p">()</span>
+        <span class="n">qmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="c">#/ numpy.sqrt(2)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Q_{x}}&#39;</span><span class="p">,</span> <span class="s">&#39;\AA^{-1}&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Q_{y}}&#39;</span><span class="p">,</span> <span class="s">&#39;\AA^{-1}&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; GenData&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model2D&quot;</span>
+        <span class="c">## Default values</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Detector</span><span class="p">())</span>
+        <span class="n">index</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">distance</span> <span class="o">=</span> <span class="mi">8000</span>   <span class="c"># mm</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength</span> <span class="o">=</span> <span class="mi">6</span>             <span class="c"># A</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="mi">5</span>  <span class="c"># mm</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="mi">5</span>  <span class="c"># mm</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="n">xmax</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="n">xmin</span> <span class="o">=</span> <span class="o">-</span><span class="n">qmax</span>
+        <span class="n">ymax</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="n">ymin</span> <span class="o">=</span> <span class="o">-</span><span class="n">qmax</span>
+        <span class="n">qstep</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span>
+
+        <span class="n">x</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">start</span><span class="o">=</span><span class="n">xmin</span><span class="p">,</span> <span class="n">stop</span><span class="o">=</span><span class="n">xmax</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="n">qstep</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+        <span class="n">y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">start</span><span class="o">=</span><span class="n">ymin</span><span class="p">,</span> <span class="n">stop</span><span class="o">=</span><span class="n">ymax</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="n">qstep</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+        <span class="c">## use data info instead</span>
+        <span class="n">new_x</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">tile</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">),</span> <span class="mi">1</span><span class="p">))</span>
+        <span class="n">new_y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">tile</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="mi">1</span><span class="p">))</span>
+        <span class="n">new_y</span> <span class="o">=</span> <span class="n">new_y</span><span class="o">.</span><span class="n">swapaxes</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+        <span class="c"># all data reuire now in 1d array</span>
+        <span class="n">qx_data</span> <span class="o">=</span> <span class="n">new_x</span><span class="o">.</span><span class="n">flatten</span><span class="p">()</span>
+        <span class="n">qy_data</span> <span class="o">=</span> <span class="n">new_y</span><span class="o">.</span><span class="n">flatten</span><span class="p">()</span>
+        <span class="n">q_data</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">qx_data</span> <span class="o">*</span> <span class="n">qx_data</span> <span class="o">+</span> <span class="n">qy_data</span> <span class="o">*</span> <span class="n">qy_data</span><span class="p">)</span>
+        <span class="c"># set all True (standing for unmasked) as default</span>
+        <span class="n">mask</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">qx_data</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span>
+        <span class="c"># store x and y bin centers in q space</span>
+        <span class="n">x_bins</span> <span class="o">=</span> <span class="n">x</span>
+        <span class="n">y_bins</span> <span class="o">=</span> <span class="n">y</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">Source</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">mask</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">err_data</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">mask</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">=</span> <span class="n">qx_data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qy_data</span> <span class="o">=</span> <span class="n">qy_data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">q_data</span> <span class="o">=</span> <span class="n">q_data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">mask</span> <span class="o">=</span> <span class="n">mask</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x_bins</span> <span class="o">=</span> <span class="n">x_bins</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">y_bins</span> <span class="o">=</span> <span class="n">y_bins</span>
+        <span class="c"># max and min taking account of the bin sizes</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xmin</span> <span class="o">=</span> <span class="n">xmin</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xmax</span> <span class="o">=</span> <span class="n">xmax</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">ymin</span> <span class="o">=</span> <span class="n">ymin</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">ymax</span> <span class="o">=</span> <span class="n">ymax</span>
+
+    <span class="k">def</span> <span class="nf">_create_default_1d_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create 2D data by default</span>
+<span class="sd">        Only when the page is on theory mode.</span>
+<span class="sd">        :warning: This data is never plotted.</span>
+<span class="sd">                    residuals.x = data_copy.x[index]</span>
+<span class="sd">            residuals.dy = numpy.ones(len(residuals.y))</span>
+<span class="sd">            residuals.dx = None</span>
+<span class="sd">            residuals.dxl = None</span>
+<span class="sd">            residuals.dxw = None</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npt_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()))</span>
+        <span class="n">qmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="c">#/ numpy.sqrt(2)</span>
+        <span class="c">## Default values</span>
+        <span class="n">xmax</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="n">xmin</span> <span class="o">=</span> <span class="n">qmax</span> <span class="o">*</span> <span class="n">_Q1D_MIN</span>
+        <span class="n">qstep</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span>
+        <span class="n">x</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">start</span><span class="o">=</span><span class="n">xmin</span><span class="p">,</span> <span class="n">stop</span><span class="o">=</span><span class="n">xmax</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="n">qstep</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+        <span class="c"># store x and y bin centers in q space</span>
+        <span class="c">#self.data.source = Source()</span>
+        <span class="n">y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+        <span class="n">dy</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+        <span class="n">dx</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="n">y</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">dx</span> <span class="o">=</span> <span class="n">dx</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">dy</span> <span class="o">=</span> <span class="n">dy</span>
+
+    <span class="k">def</span> <span class="nf">_draw1D</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">y_out</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Complete get the result of modelthread and create model 2D</span>
+<span class="sd">        that can be plot.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">page_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">id</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span>
+        
+        <span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="n">y_out</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">dx</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">dx</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">dy</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">dy</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Q_{x}}&#39;</span><span class="p">,</span> <span class="s">&#39;\AA^{-1}&#39;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Intensity}&#39;</span><span class="p">,</span> <span class="s">&#39;cm^{-1}&#39;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; GenData1D&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model1D&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="s">&#39;1d&#39;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="s">&quot;Generic model1D &quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span> <span class="o">+</span> <span class="s">&#39;: &#39;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">file_name</span> \
+                        <span class="o">+</span> <span class="s">&#39; #</span><span class="si">%s</span><span class="s">&#39;</span><span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_num</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;_1D&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model1D&quot;</span>  <span class="o">+</span>\
+                             <span class="s">&#39; #</span><span class="si">%s</span><span class="s">&#39;</span><span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_num</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;_1D&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+
+        <span class="n">title</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span>
+        <span class="n">_yaxis</span><span class="p">,</span> <span class="n">_yunit</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">get_yaxis</span><span class="p">()</span>
+        <span class="n">_xaxis</span><span class="p">,</span> <span class="n">_xunit</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">get_xaxis</span><span class="p">()</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">_xaxis</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">_xunit</span><span class="p">))</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">_yaxis</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">_yunit</span><span class="p">))</span>
+        
+        <span class="k">if</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+            <span class="n">data_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">new_plot</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">data_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span> <span class="o">+</span> <span class="s">&#39;1d&#39;</span>
+
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">title</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="s">&quot;Gen Theory for </span><span class="si">%s</span><span class="s"> &quot;</span><span class="o">%</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="n">data_name</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">label</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span>
+        <span class="c">#theory_data = deepcopy(new_plot)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="n">new_plot</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
+                                           <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                           <span class="n">state</span><span class="o">=</span><span class="n">state</span><span class="p">)</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span>
+        <span class="n">num_graph</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_num</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">draw_graph</span><span class="p">,</span> <span class="n">new_plot</span><span class="p">,</span> 
+                     <span class="n">title</span><span class="o">=</span><span class="s">&quot;GEN Graph </span><span class="si">%s</span><span class="s">: &quot;</span><span class="o">%</span> <span class="n">num_graph</span> <span class="o">+</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph_num</span> <span class="o">+=</span> <span class="mi">1</span>
+                
+    <span class="k">def</span> <span class="nf">_draw2D</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">image</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Complete get the result of modelthread and create model 2D</span>
+<span class="sd">        that can be plot.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">page_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">id</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span>
+        
+        <span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span>
+        <span class="n">qmin</span> <span class="o">=</span> <span class="mf">0.0</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="n">numpy</span><span class="o">.</span><span class="n">nan_to_num</span><span class="p">(</span><span class="n">image</span><span class="p">)</span>
+        <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data2D</span><span class="p">(</span><span class="n">image</span><span class="o">=</span><span class="n">image</span><span class="p">,</span> <span class="n">err_image</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">err_data</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="s">&#39;2d&#39;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="s">&quot;Generic model 2D &quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span> <span class="o">+</span> <span class="s">&#39;: &#39;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">file_name</span> \
+                        <span class="o">+</span> <span class="s">&#39; #</span><span class="si">%s</span><span class="s">&#39;</span><span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_num</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;_2D&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model2D&quot;</span> \
+                        <span class="o">+</span> <span class="s">&#39; #</span><span class="si">%s</span><span class="s">&#39;</span><span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_num</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;_2D&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">detector</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">detector</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">source</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">qx_data</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">qy_data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">qy_data</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">q_data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">q_data</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">mask</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">mask</span>
+        <span class="c">## plot boundaries</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">ymin</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">ymin</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">ymax</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">ymax</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xmin</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">xmin</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xmax</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">xmax</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">title</span>
+        <span class="n">_yaxis</span><span class="p">,</span> <span class="n">_yunit</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">get_yaxis</span><span class="p">()</span>
+        <span class="n">_xaxis</span><span class="p">,</span> <span class="n">_xunit</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">get_xaxis</span><span class="p">()</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">_xaxis</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">_xunit</span><span class="p">))</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">_yaxis</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="n">_yunit</span><span class="p">))</span>
+        
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+            <span class="n">data_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">data_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span> <span class="o">+</span> <span class="s">&#39;2d&#39;</span>
+
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">title</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="s">&quot;Gen Theory for </span><span class="si">%s</span><span class="s"> &quot;</span><span class="o">%</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="n">data_name</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">label</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span>
+        <span class="c">#theory_data = deepcopy(new_plot)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
+                                           <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                           <span class="n">state</span><span class="o">=</span><span class="n">state</span><span class="p">)</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span>
+        <span class="n">num_graph</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_num</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">draw_graph</span><span class="p">,</span> <span class="n">new_plot</span><span class="p">,</span> 
+                     <span class="n">title</span><span class="o">=</span><span class="s">&quot;GEN Graph </span><span class="si">%s</span><span class="s">: &quot;</span><span class="o">%</span> <span class="n">num_graph</span> <span class="o">+</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph_num</span> <span class="o">+=</span> <span class="mi">1</span>
+         
+<div class="viewcode-block" id="SasGenPanel.set_scale2d"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.set_scale2d">[docs]</a>    <span class="k">def</span> <span class="nf">set_scale2d</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">scale</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set SLD plot scale</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">scale2d</span> <span class="o">=</span> <span class="bp">None</span>
+        </div>
+<div class="viewcode-block" id="SasGenPanel.on_panel_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenPanel.on_panel_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_panel_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Close SLD panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Not implemented   </span>
+                  </div></div>
+<div class="viewcode-block" id="OmfPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.OmfPanel">[docs]</a><span class="k">class</span> <span class="nc">OmfPanel</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Provides the sas gen calculator GUI.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal nickname for the window, used by the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;SLD Pixel Info&quot;</span>
+    <span class="c">## Name to appear on the window title bar</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;SLD Pixel Info &quot;</span>
+    <span class="c">## Flag to tell the AUI manager to put this panel in the center pane</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">False</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</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">RAISED_BORDER</span><span class="p">,</span> 
+                               <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="c">#Font size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>  
+        <span class="c"># Object that receive status event</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">MagSLD</span><span class="p">([</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">0</span><span class="p">])</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">default_shape</span> <span class="o">=</span> <span class="s">&#39;rectangular&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+       
+<div class="viewcode-block" id="OmfPanel.set_slddata"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.OmfPanel.set_slddata">[docs]</a>    <span class="k">def</span> <span class="nf">set_slddata</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">slddata</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set sld data related items</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="n">slddata</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_slddata_ctr_val</span><span class="p">(</span><span class="n">slddata</span><span class="p">)</span>
+        <span class="c"># Make sure that self._set_slddata_ctr_val() is finished</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_set_omfdata_ctr</span><span class="p">,</span> <span class="n">slddata</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="OmfPanel.get_sld_val"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.OmfPanel.get_sld_val">[docs]</a>    <span class="k">def</span> <span class="nf">get_sld_val</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set sld_n of slddata on sld input</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">sld_sets</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_get_other_val</span><span class="p">()</span>
+        <span class="k">for</span> <span class="nb">list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">slds</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+                <span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+                <span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="n">sld_sets</span><span class="p">[</span><span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span> <span class="o">=</span> <span class="n">val</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="n">_set_error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+                        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span>
+            <span class="k">else</span><span class="p">:</span>
+               <span class="n">sld_sets</span><span class="p">[</span><span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">sld_sets</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="n">key_low</span> <span class="o">=</span> <span class="n">key</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">key_low</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;mx&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">sld_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">sld_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">sld_mx</span>
+                <span class="n">mx</span> <span class="o">=</span> <span class="n">sld_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
+            <span class="k">elif</span> <span class="n">key_low</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;my&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">sld_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">sld_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">sld_my</span>
+                <span class="n">my</span> <span class="o">=</span> <span class="n">sld_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
+            <span class="k">elif</span> <span class="n">key_low</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;mz&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">sld_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">sld_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">sld_mz</span>
+                <span class="n">mz</span> <span class="o">=</span> <span class="n">sld_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">sld_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">set_sldn</span><span class="p">(</span><span class="n">sld_sets</span><span class="p">[</span><span class="n">key</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">set_sldms</span><span class="p">(</span><span class="n">mx</span><span class="p">,</span> <span class="n">my</span><span class="p">,</span> <span class="n">mz</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_slddata_ctr_val</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="p">)</span>
+        
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span>
+    </div>
+<div class="viewcode-block" id="OmfPanel.get_pix_volumes"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.OmfPanel.get_pix_volumes">[docs]</a>    <span class="k">def</span> <span class="nf">get_pix_volumes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the pixel volume</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">vol</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">vol_pix</span>
+        
+        <span class="k">return</span> <span class="n">vol</span>
+                </div>
+    <span class="k">def</span> <span class="nf">_get_other_val</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">omfdata</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">OMFData</span><span class="p">()</span>
+        <span class="n">sets</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">lst</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">stepsize</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">lst</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+                    <span class="n">val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">lst</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="n">sets</span><span class="p">[</span><span class="n">lst</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span> <span class="o">=</span> <span class="n">val</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">sets</span><span class="p">[</span><span class="n">lst</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span> <span class="o">=</span> <span class="bp">None</span>
+                    <span class="k">return</span>
+            <span class="k">for</span> <span class="n">lst</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">lst</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+                    <span class="n">val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">lst</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="n">sets</span><span class="p">[</span><span class="n">lst</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span> <span class="o">=</span> <span class="n">val</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">sets</span><span class="p">[</span><span class="n">lst</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span> <span class="o">=</span> <span class="bp">None</span>
+                    <span class="k">return</span>
+                    
+            <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">sets</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="k">exec</span> <span class="s">&quot;omfdata.</span><span class="si">%s</span><span class="s"> = sets[&#39;</span><span class="si">%s</span><span class="s">&#39;]&quot;</span><span class="o">%</span> <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span>            
+
+            <span class="n">omf2sld</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">OMF2SLD</span><span class="p">()</span>
+            <span class="n">omf2sld</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">omfdata</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">default_shape</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="n">omf2sld</span><span class="o">.</span><span class="n">output</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="s">&quot;Default SLD Profile&quot;</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;OMF Panel: </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">infor</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+            <span class="c">#logging.error(msg)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="c"># inform msg to wx</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                        <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="n">infor</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+                
+    <span class="k">def</span> <span class="nf">_set_slddata_ctr_val</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">slddata</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set slddata crl</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">val</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">slddata</span><span class="o">.</span><span class="n">sld_n</span><span class="p">))</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">val</span> <span class="o">=</span> <span class="s">&#39;Unknown&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npix_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_set_omfdata_ctr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">omfdata</span><span class="p">):</span>    
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the textctr box values</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        
+        <span class="k">if</span> <span class="n">omfdata</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_none_text</span><span class="p">()</span>
+            <span class="k">return</span>
+        <span class="n">nodes_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_nodes_key_list</span><span class="p">(</span><span class="n">omfdata</span><span class="p">)</span>
+        <span class="n">step_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_step_key_list</span><span class="p">(</span><span class="n">omfdata</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">ctr_list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">nodes_list</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">ctr_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">key</span><span class="p">:</span>
+                    <span class="n">ctr_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">nodes_list</span><span class="p">[</span><span class="n">key</span><span class="p">],</span> <span class="bp">True</span><span class="p">))</span>
+                    <span class="n">ctr_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="ow">not</span> <span class="n">omfdata</span><span class="o">.</span><span class="n">is_data</span><span class="p">)</span>
+                    <span class="k">break</span>
+        <span class="k">for</span> <span class="n">ctr_list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">stepsize</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">step_list</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">ctr_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">key</span><span class="p">:</span>
+                    <span class="n">ctr_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">step_list</span><span class="p">[</span><span class="n">key</span><span class="p">],</span> <span class="bp">True</span><span class="p">))</span>
+                    <span class="n">ctr_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="ow">not</span> <span class="n">omfdata</span><span class="o">.</span><span class="n">is_data</span><span class="p">)</span>
+                    <span class="k">break</span>   
+                
+    <span class="k">def</span> <span class="nf">_set_none_text</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set Unknown in textctrls</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">val</span> <span class="o">=</span> <span class="s">&#39;Unknown&#39;</span>
+        <span class="k">for</span> <span class="n">ctr_list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="p">:</span>
+            <span class="n">ctr_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">ctr_list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">stepsize</span><span class="p">:</span>
+            <span class="n">ctr_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+                
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Define the main sizers building to build this application.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">npixels_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_sld</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                    <span class="nb">str</span><span class="p">(</span><span class="s">&quot;Mean SLD&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_node</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="s">&quot;Nodes&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_sld</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_sld</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_stepsize</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="s">&quot;Step Size&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_node</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_node</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_stepsize</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_stepsize</span><span class="p">,</span>
+                                                    <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">node_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">step_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+                
+    <span class="k">def</span> <span class="nf">_layout_npix</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Build No of pixels sizer</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">num_pix_text</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;No. of Pixels: &quot;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">npix_ctl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_slddata_ctr_val</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_omfdata_ctr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">npixels_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">num_pix_text</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npix_ctl</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+
+    <span class="k">def</span> <span class="nf">_layout_slds</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Build nuclear sld sizer</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slds</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">omfdata</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span>
+        <span class="k">if</span> <span class="n">omfdata</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">raise</span>
+        <span class="n">sld_key_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_slds_key_list</span><span class="p">(</span><span class="n">omfdata</span><span class="p">)</span>
+        <span class="c"># Dic is not sorted</span>
+        <span class="n">key_list</span> <span class="o">=</span> <span class="p">[</span><span class="n">key</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">sld_key_list</span><span class="o">.</span><span class="n">keys</span><span class="p">()]</span>
+        <span class="c"># Sort here</span>
+        <span class="n">key_list</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
+        <span class="n">is_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">is_data</span>
+        <span class="n">sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
+        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">key_list</span><span class="p">:</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="n">sld_key_list</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
+            <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="c">## add parameter value</span>
+            <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">ctl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+            <span class="n">ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="bp">True</span><span class="p">))</span>
+            <span class="n">ctl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="ow">not</span> <span class="n">is_data</span><span class="p">)</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+            <span class="c">## add unit</span>
+            <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">s_unit</span> <span class="o">=</span> <span class="s">&#39;[&#39;</span> <span class="o">+</span> <span class="n">omfdata</span><span class="o">.</span><span class="n">sld_unit</span> <span class="o">+</span> <span class="s">&#39;]&#39;</span>
+            <span class="n">unit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">s_unit</span><span class="p">)</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">slds</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">key</span><span class="p">,</span> <span class="n">ctl</span><span class="p">,</span> <span class="n">unit</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span> 
+               
+    <span class="k">def</span> <span class="nf">_layout_nodes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing data&#39;s name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">omfdata</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span>
+        <span class="k">if</span> <span class="n">omfdata</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">raise</span>
+        <span class="n">key_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_nodes_key_list</span><span class="p">(</span><span class="n">omfdata</span><span class="p">)</span>
+        <span class="n">is_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">is_data</span>
+        <span class="n">sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
+        <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">key_list</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="c">## add parameter value</span>
+            <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">ctl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+            <span class="n">ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onparamEnter</span> <span class="p">)</span>
+            <span class="n">ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="bp">True</span><span class="p">))</span>
+            <span class="n">ctl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="ow">not</span> <span class="n">is_data</span><span class="p">)</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+            <span class="c">## add unit</span>
+            <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">unit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">key</span><span class="p">,</span> <span class="n">ctl</span><span class="p">,</span> <span class="n">unit</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">node_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+            
+    <span class="k">def</span> <span class="nf">_layout_stepsize</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing slit size information</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">stepsize</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">omfdata</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span>
+        <span class="k">if</span> <span class="n">omfdata</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">raise</span>
+        <span class="n">key_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_step_key_list</span><span class="p">(</span><span class="n">omfdata</span><span class="p">)</span>
+        <span class="n">is_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">is_data</span>
+        <span class="n">sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
+        <span class="c">#key_list.sort()</span>
+        <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">key_list</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="c">## add parameter value</span>
+            <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">ctl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+            <span class="n">ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onstepsize</span> <span class="p">)</span>
+            <span class="n">ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="bp">True</span><span class="p">))</span>
+            <span class="n">ctl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="ow">not</span> <span class="n">is_data</span><span class="p">)</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+            <span class="c">## add unit</span>
+            <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">p_unit</span> <span class="o">=</span> <span class="s">&#39;[&#39;</span> <span class="o">+</span> <span class="n">omfdata</span><span class="o">.</span><span class="n">pos_unit</span> <span class="o">+</span> <span class="s">&#39;]&#39;</span>
+            <span class="n">unit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">p_unit</span><span class="p">)</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">stepsize</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">key</span><span class="p">,</span> <span class="n">ctl</span><span class="p">,</span> <span class="n">unit</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">step_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_hint</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing hint </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Load an omf or 3d sld profile data file.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">hint_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)])</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_draw</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span><span class="s">&#39;Draw Points&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_draw</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_sld_draw</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_draw</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Draw a scatter plot for sld profile.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_save</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span><span class="s">&#39;Save SLD Data&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_save</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_save</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_save</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_save</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Save SLD data.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_draw</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_save</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw window content</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_nodes</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_stepsize</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_npix</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_slds</span><span class="p">()</span>
+        <span class="c">#self._layout_hint()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_node</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">node_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_stepsize</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">step_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_sld</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">npixels_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_sld</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_node</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_stepsize</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_get_nodes_key_list</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return nodes key list</span>
+<span class="sd">        </span>
+<span class="sd">        :Param data: OMFData</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">key_list</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;xnodes&#39;</span> <span class="p">:</span> <span class="n">data</span><span class="o">.</span><span class="n">xnodes</span><span class="p">,</span> 
+                    <span class="s">&#39;ynodes&#39;</span> <span class="p">:</span> <span class="n">data</span><span class="o">.</span><span class="n">ynodes</span><span class="p">,</span>
+                    <span class="s">&#39;znodes&#39;</span> <span class="p">:</span> <span class="n">data</span><span class="o">.</span><span class="n">znodes</span><span class="p">}</span>
+        <span class="k">return</span> <span class="n">key_list</span>
+        
+    <span class="k">def</span> <span class="nf">_get_slds_key_list</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return nodes key list</span>
+<span class="sd">        </span>
+<span class="sd">        :Param data: OMFData</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">key_list</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;Nucl.&#39;</span> <span class="p">:</span> <span class="n">data</span><span class="o">.</span><span class="n">sld_n</span><span class="p">,</span> 
+                    <span class="s">&#39;Mx&#39;</span> <span class="p">:</span> <span class="n">data</span><span class="o">.</span><span class="n">sld_mx</span><span class="p">,</span>
+                    <span class="s">&#39;My&#39;</span> <span class="p">:</span> <span class="n">data</span><span class="o">.</span><span class="n">sld_my</span><span class="p">,</span>
+                    <span class="s">&#39;Mz&#39;</span> <span class="p">:</span> <span class="n">data</span><span class="o">.</span><span class="n">sld_mz</span><span class="p">}</span>
+        <span class="k">return</span> <span class="n">key_list</span>
+
+    <span class="k">def</span> <span class="nf">_get_step_key_list</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return step key list</span>
+<span class="sd">        </span>
+<span class="sd">        :Param data: OMFData</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">key_list</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;xstepsize&#39;</span> <span class="p">:</span> <span class="n">data</span><span class="o">.</span><span class="n">xstepsize</span><span class="p">,</span> 
+                    <span class="s">&#39;ystepsize&#39;</span> <span class="p">:</span> <span class="n">data</span><span class="o">.</span><span class="n">ystepsize</span><span class="p">,</span>
+                    <span class="s">&#39;zstepsize&#39;</span> <span class="p">:</span> <span class="n">data</span><span class="o">.</span><span class="n">zstepsize</span><span class="p">}</span>
+        <span class="k">return</span> <span class="n">key_list</span>        
+    
+<div class="viewcode-block" id="OmfPanel.set_sld_ctr"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.OmfPanel.set_sld_ctr">[docs]</a>    <span class="k">def</span> <span class="nf">set_sld_ctr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sld_data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set sld textctrls</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">sld_data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">ctr_list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">slds</span><span class="p">:</span>
+                <span class="n">ctr_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="c">#break   </span>
+            <span class="k">return</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="n">sld_data</span>
+        <span class="n">sld_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_slds_key_list</span><span class="p">(</span><span class="n">sld_data</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">ctr_list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">slds</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">sld_list</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">ctr_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">key</span><span class="p">:</span>
+                    <span class="n">min_val</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">min</span><span class="p">(</span><span class="n">sld_list</span><span class="p">[</span><span class="n">key</span><span class="p">])</span>
+                    <span class="n">max_val</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">max</span><span class="p">(</span><span class="n">sld_list</span><span class="p">[</span><span class="n">key</span><span class="p">])</span>
+                    <span class="n">mean_val</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">sld_list</span><span class="p">[</span><span class="n">key</span><span class="p">])</span>
+                    <span class="n">enable</span> <span class="o">=</span> <span class="p">(</span><span class="n">min_val</span> <span class="o">==</span> <span class="n">max_val</span><span class="p">)</span> <span class="ow">and</span> \
+                             <span class="n">sld_data</span><span class="o">.</span><span class="n">pix_type</span> <span class="o">==</span> <span class="s">&#39;pixel&#39;</span>
+                    <span class="n">ctr_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">mean_val</span><span class="p">,</span> <span class="bp">True</span><span class="p">))</span>
+                    <span class="n">ctr_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="n">enable</span><span class="p">)</span>
+                    <span class="c">#ctr_list[2].SetLabel(&quot;[&quot; + sld_data.sld_unit + &quot;]&quot;)</span>
+                    <span class="k">break</span>   
+</div>
+<div class="viewcode-block" id="OmfPanel.on_sld_draw"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.OmfPanel.on_sld_draw">[docs]</a>    <span class="k">def</span> <span class="nf">on_sld_draw</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw sld profile as scattered plot</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">sld_draw</span><span class="p">()</span>
+         </div>
+<div class="viewcode-block" id="OmfPanel.on_save"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.OmfPanel.on_save">[docs]</a>    <span class="k">def</span> <span class="nf">on_save</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Close the window containing this panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">check_inputs</span><span class="p">()</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_sld_val</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_main_panel_sld_data</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="p">)</span>
+        
+        <span class="n">reader</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">SLDReader</span><span class="p">()</span> 
+        <span class="n">extension</span> <span class="o">=</span> <span class="s">&#39;*.sld&#39;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">data</span><span class="o">=</span> <span class="bp">None</span>
+        <span class="n">location</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_path</span><span class="p">()</span>
+        <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="bp">self</span><span class="p">,</span> <span class="s">&quot;Save sld file&quot;</span><span class="p">,</span>
+                            <span class="n">location</span><span class="p">,</span> <span class="s">&quot;sld_file&quot;</span><span class="p">,</span>
+                             <span class="n">extension</span><span class="p">,</span> 
+                             <span class="n">wx</span><span class="o">.</span><span class="n">SAVE</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_file_location</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">path</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">path</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span>
+            
+            <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_sld_data</span><span class="p">()</span>
+            <span class="n">fName</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">path</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="s">&#39;.&#39;</span> <span class="o">+</span> <span class="n">extension</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+            <span class="k">if</span> <span class="n">data</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">reader</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">fName</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">raise</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> cannot write </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="s">&#39;Generic Scattering&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">path</span><span class="p">))</span>
+                <span class="n">infor</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+                <span class="c">#logging.error(msg)</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="c"># inform msg to wx</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                            <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="n">infor</span><span class="p">))</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+            <span class="k">return</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error occurred while saving. &quot;</span>
+            <span class="n">infor</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="c"># inform msg to wx</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                        <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="n">infor</span><span class="p">))</span> 
+                <span class="bp">self</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>   
+</div>
+    <span class="k">def</span> <span class="nf">_onparamEnter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            <span class="n">ctl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+            <span class="n">ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+            <span class="c">#_set_error(self, ctl)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="nb">float</span><span class="p">(</span><span class="n">ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="n">_set_error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ctl</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">npts</span> <span class="o">=</span> <span class="mi">1</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="p">:</span>
+                <span class="n">n_val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                <span class="k">if</span> <span class="n">n_val</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                    <span class="n">npts</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
+                    <span class="k">break</span>
+                <span class="k">if</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">n_val</span><span class="p">):</span>
+                    <span class="n">npts</span> <span class="o">*=</span> <span class="nb">int</span><span class="p">(</span><span class="n">n_val</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">npts</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">nop</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_npts_from_slddata</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">nop</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">nop</span> <span class="o">=</span> <span class="n">npts</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">display_npts</span><span class="p">(</span><span class="n">nop</span><span class="p">)</span>
+                
+        <span class="n">ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">flag</span>
+    
+    <span class="k">def</span> <span class="nf">_set_volume_ctr_val</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">npts</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set total volume</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">total_volume</span> <span class="o">=</span> <span class="n">npts</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">vol_pix</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_volume_ctr_val</span><span class="p">(</span><span class="n">total_volume</span><span class="p">)</span>
+                    
+    <span class="k">def</span> <span class="nf">_onstepsize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On stepsize event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            <span class="n">ctl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+            <span class="n">ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="n">flag</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span><span class="c">#ctl.IsEnabled():</span>
+            <span class="n">s_size</span> <span class="o">=</span> <span class="mf">1.0</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">stepsize</span><span class="p">:</span>
+                    <span class="n">s_val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="k">if</span> <span class="n">s_val</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                        <span class="n">ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                        <span class="k">return</span>
+                    <span class="k">if</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">s_val</span><span class="p">):</span>
+                        <span class="n">s_size</span> <span class="o">*=</span> <span class="n">s_val</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">set_pixel_volumes</span><span class="p">(</span><span class="n">s_size</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">ctl</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+                    <span class="n">total_volume</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="o">.</span><span class="n">vol_pix</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_volume_ctr_val</span><span class="p">(</span><span class="n">total_volume</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+        <span class="n">ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+  
+         
+<div class="viewcode-block" id="OmfPanel.set_npts_from_slddata"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.OmfPanel.set_npts_from_slddata">[docs]</a>    <span class="k">def</span> <span class="nf">set_npts_from_slddata</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set total n. of points form the sld data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">sld_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_sld_from_omf</span><span class="p">()</span>
+            <span class="c">#nop = (nop * numpy.pi) / 6</span>
+            <span class="n">nop</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">sld_data</span><span class="o">.</span><span class="n">sld_n</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">nop</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">return</span> <span class="n">nop</span>
+    </div>
+<div class="viewcode-block" id="OmfPanel.display_npts"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.OmfPanel.display_npts">[docs]</a>    <span class="k">def</span> <span class="nf">display_npts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nop</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Displays Npts ctrl</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npix_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">nop</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npix_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_etime</span><span class="p">()</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_set_volume_ctr_val</span><span class="p">,</span> <span class="n">nop</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c"># On Init</span>
+            <span class="k">pass</span>
+    </div>
+<div class="viewcode-block" id="OmfPanel.check_inputs"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.OmfPanel.check_inputs">[docs]</a>    <span class="k">def</span> <span class="nf">check_inputs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        check if the inputs are valid</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_input_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">slds</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_input_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_input_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">stepsize</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">flag</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_check_input_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check list values</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">:</span>
+            <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+            <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="nb">float</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="n">_set_error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                <span class="k">break</span>
+        <span class="k">return</span> <span class="n">flag</span>
+</div>
+<div class="viewcode-block" id="SasGenWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow">[docs]</a><span class="k">class</span> <span class="nc">SasGenWindow</span><span class="p">(</span><span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    GEN SAS main window</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span> <span class="bp">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Generic Scattering Calculator&quot;</span><span class="p">,</span>
+                <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span> <span class="o">*</span> <span class="mf">1.3</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span> <span class="o">*</span> <span class="mf">1.65</span><span class="p">),</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Init</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">size</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span> <span class="o">=</span> <span class="n">OmfPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">SasGenPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">omfdata</span> <span class="o">=</span> <span class="n">sas_gen</span><span class="o">.</span><span class="n">OMFData</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span> 
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_mgr</span> <span class="o">=</span> <span class="n">aui</span><span class="o">.</span><span class="n">AuiManager</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_mgr</span><span class="o">.</span><span class="n">SetDockSizeConstraint</span><span class="p">(</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_plot_title</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">scale2d</span> <span class="o">=</span> <span class="s">&#39;log_{10}&#39;</span>
+        <span class="bp">self</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_CLOSE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_build_toolbar</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">build_panels</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetPosition</span><span class="p">((</span><span class="mi">25</span><span class="p">,</span> <span class="mi">150</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_build_toolbar</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Build toolbar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">tsize</span> <span class="o">=</span> <span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="c"># The legacy code doesn&#39;t work well for wx 3.0</span>
+        <span class="c"># but the old code produces better results with wx 2.8</span>
+        <span class="k">if</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERSION_STRING</span> <span class="o">&gt;=</span> <span class="s">&#39;3.0.0.0&#39;</span><span class="p">:</span>
+            <span class="n">tb</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ToolBar</span><span class="p">(</span><span class="bp">self</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">TB_HORIZONTAL</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">TB_FLAT</span><span class="p">)</span>
+            <span class="n">sizer</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>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">tb</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">EXPAND</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">sizer</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">tb</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">CreateToolBar</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">TB_HORIZONTAL</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">TB_FLAT</span><span class="p">)</span>
+        <span class="n">open_bmp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ArtProvider</span><span class="o">.</span><span class="n">GetBitmap</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ART_FILE_OPEN</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ART_TOOLBAR</span><span class="p">,</span> 
+                                            <span class="n">tsize</span><span class="p">)</span>
+        <span class="n">save_bmp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ArtProvider</span><span class="o">.</span><span class="n">GetBitmap</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ART_FILE_SAVE_AS</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ART_TOOLBAR</span><span class="p">,</span>
+                                            <span class="n">tsize</span><span class="p">)</span>
+        <span class="n">close_bmp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ArtProvider</span><span class="o">.</span><span class="n">GetBitmap</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ART_QUIT</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ART_TOOLBAR</span><span class="p">,</span> 
+                                            <span class="n">tsize</span><span class="p">)</span>
+        <span class="n">help_bmp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ArtProvider</span><span class="o">.</span><span class="n">GetBitmap</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ART_HELP</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ART_TOOLBAR</span><span class="p">,</span> 
+                                           <span class="p">(</span><span class="mi">17</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">tb</span><span class="o">.</span><span class="n">AddLabelTool</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Open&quot;</span><span class="p">,</span> <span class="n">open_bmp</span><span class="p">,</span> <span class="n">shortHelp</span><span class="o">=</span><span class="s">&quot;Open&quot;</span><span class="p">,</span> 
+                        <span class="n">longHelp</span><span class="o">=</span><span class="s">&quot;Open sld/omf file&quot;</span><span class="p">)</span>
+        <span class="bp">self</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_TOOL</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_open_file</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">tb</span><span class="o">.</span><span class="n">AddSimpleTool</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">save_bmp</span><span class="p">,</span> <span class="s">&quot;Save&quot;</span><span class="p">,</span> <span class="s">&quot;Save as sld file&quot;</span><span class="p">)</span>
+        <span class="bp">self</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_TOOL</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_save_file</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        
+        <span class="n">tb</span><span class="o">.</span><span class="n">AddSeparator</span><span class="p">()</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">tb</span><span class="o">.</span><span class="n">AddSimpleTool</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">close_bmp</span><span class="p">,</span> <span class="s">&quot;Quit&quot;</span><span class="p">,</span> <span class="s">&quot;Quit&quot;</span><span class="p">)</span>
+        <span class="bp">self</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_TOOL</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        
+        <span class="n">tb</span><span class="o">.</span><span class="n">AddSeparator</span><span class="p">()</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">tb</span><span class="o">.</span><span class="n">AddSimpleTool</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">help_bmp</span><span class="p">,</span> <span class="s">&quot;Help&quot;</span><span class="p">,</span> <span class="s">&quot;Help&quot;</span><span class="p">)</span>
+        <span class="bp">self</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_TOOL</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_help</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+
+        <span class="n">tb</span><span class="o">.</span><span class="n">Realize</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_build_menubar</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Build menubar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">tsize</span> <span class="o">=</span> <span class="p">(</span><span class="mi">13</span><span class="p">,</span> <span class="mi">13</span><span class="p">)</span>
+        <span class="n">open_bmp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ArtProvider</span><span class="o">.</span><span class="n">GetBitmap</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ART_FILE_OPEN</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ART_TOOLBAR</span><span class="p">,</span> 
+                                            <span class="n">tsize</span><span class="p">)</span>
+        <span class="n">save_bmp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ArtProvider</span><span class="o">.</span><span class="n">GetBitmap</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ART_FILE_SAVE_AS</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ART_TOOLBAR</span><span class="p">,</span>
+                                            <span class="n">tsize</span><span class="p">)</span>
+        <span class="n">quit_bmp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ArtProvider</span><span class="o">.</span><span class="n">GetBitmap</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ART_QUIT</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ART_TOOLBAR</span><span class="p">,</span> 
+                                           <span class="n">tsize</span><span class="p">)</span>
+        <span class="n">help_bmp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ArtProvider</span><span class="o">.</span><span class="n">GetBitmap</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ART_HELP</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ART_TOOLBAR</span><span class="p">,</span> 
+                                           <span class="p">(</span><span class="mi">13</span><span class="p">,</span> <span class="mi">15</span><span class="p">))</span>
+        
+        <span class="n">menu_bar</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MenuBar</span><span class="p">()</span>
+        
+        <span class="n">menu</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MenuItem</span><span class="p">(</span><span class="n">menu</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;&amp;Open sld/omf file&quot;</span><span class="p">)</span>
+        <span class="n">item</span><span class="o">.</span><span class="n">SetBitmap</span><span class="p">(</span><span class="n">open_bmp</span><span class="p">)</span>
+        <span class="n">menu</span><span class="o">.</span><span class="n">AppendItem</span><span class="p">(</span><span class="n">item</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_open_file</span><span class="p">)</span>
+        
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MenuItem</span><span class="p">(</span><span class="n">menu</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;&amp;Save as sld file&quot;</span><span class="p">)</span>
+        <span class="n">item</span><span class="o">.</span><span class="n">SetBitmap</span><span class="p">(</span><span class="n">save_bmp</span><span class="p">)</span>
+        <span class="n">menu</span><span class="o">.</span><span class="n">AppendItem</span><span class="p">(</span><span class="n">item</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_save_file</span><span class="p">)</span>
+        
+        <span class="n">menu</span><span class="o">.</span><span class="n">AppendSeparator</span><span class="p">()</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MenuItem</span><span class="p">(</span><span class="n">menu</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;&amp;Quit&quot;</span><span class="p">)</span>
+        <span class="n">item</span><span class="o">.</span><span class="n">SetBitmap</span><span class="p">(</span><span class="n">quit_bmp</span><span class="p">)</span>
+        <span class="n">menu</span><span class="o">.</span><span class="n">AppendItem</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+
+        <span class="n">menu_bar</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">menu</span><span class="p">,</span> <span class="s">&quot;&amp;File&quot;</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        
+        <span class="n">menu_help</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MenuItem</span><span class="p">(</span><span class="n">menu_help</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;&amp;Theory and GUI&quot;</span><span class="p">)</span>
+        <span class="n">item</span><span class="o">.</span><span class="n">SetBitmap</span><span class="p">(</span><span class="n">help_bmp</span><span class="p">)</span>
+        <span class="n">menu_help</span><span class="o">.</span><span class="n">AppendItem</span><span class="p">(</span><span class="n">item</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_help</span><span class="p">)</span>
+        
+        <span class="n">menu_bar</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">menu_help</span><span class="p">,</span> <span class="s">&quot;&amp;Help&quot;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetMenuBar</span><span class="p">(</span><span class="n">menu_bar</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="SasGenWindow.build_panels"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.build_panels">[docs]</a>    <span class="k">def</span> <span class="nf">build_panels</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_sld_data</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_mgr</span><span class="o">.</span><span class="n">AddPane</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="p">,</span> <span class="n">aui</span><span class="o">.</span><span class="n">AuiPaneInfo</span><span class="p">()</span><span class="o">.</span>
+                              <span class="n">Name</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">window_name</span><span class="p">)</span><span class="o">.</span>
+                              <span class="n">CenterPane</span><span class="p">()</span><span class="o">.</span>
+                              <span class="c"># This is where we set the size of</span>
+                              <span class="c"># the application window</span>
+                              <span class="n">BestSize</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Size</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> 
+                                               <span class="n">PANEL_HEIGHT</span><span class="p">))</span><span class="o">.</span>
+                              <span class="n">Show</span><span class="p">())</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">_mgr</span><span class="o">.</span><span class="n">AddPane</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="p">,</span> <span class="n">aui</span><span class="o">.</span><span class="n">AuiPaneInfo</span><span class="p">()</span><span class="o">.</span>
+                              <span class="n">Name</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">window_name</span><span class="p">)</span><span class="o">.</span>
+                              <span class="n">Caption</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">window_caption</span><span class="p">)</span><span class="o">.</span>
+                              <span class="n">CloseButton</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span><span class="o">.</span>
+                              <span class="n">Right</span><span class="p">()</span><span class="o">.</span>
+                              <span class="n">Floatable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span><span class="o">.</span>
+                              <span class="n">BestSize</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Size</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="o">/</span><span class="mf">2.5</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">))</span><span class="o">.</span>
+                              <span class="n">Show</span><span class="p">())</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">_mgr</span><span class="o">.</span><span class="n">Update</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="SasGenWindow.get_sld_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.get_sld_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_sld_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return slddata</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span>
+    </div>
+<div class="viewcode-block" id="SasGenWindow.get_sld_from_omf"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.get_sld_from_omf">[docs]</a>    <span class="k">def</span> <span class="nf">get_sld_from_omf</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">get_sld_val</span><span class="p">()</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span>
+    </div>
+<div class="viewcode-block" id="SasGenWindow.set_sld_n"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.set_sld_n">[docs]</a>    <span class="k">def</span> <span class="nf">set_sld_n</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sld</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="n">sld</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_sld_data</span><span class="p">(</span><span class="n">sld</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="SasGenWindow.set_sld_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.set_sld_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_sld_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set omfdata</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="n">enable</span> <span class="o">=</span> <span class="p">(</span><span class="ow">not</span> <span class="n">data</span><span class="o">==</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_omfpanel_sld_data</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">bt_save</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="n">enable</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_etime</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="SasGenWindow.set_omfpanel_npts"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.set_omfpanel_npts">[docs]</a>    <span class="k">def</span> <span class="nf">set_omfpanel_npts</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set Npts in omf panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">nop</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">set_npts_from_slddata</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">display_npts</span><span class="p">(</span><span class="n">nop</span><span class="p">)</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_set_omfpanel_sld_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set sld_data in omf panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">set_slddata</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">set_sld_ctr</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="SasGenWindow.check_omfpanel_inputs"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.check_omfpanel_inputs">[docs]</a>    <span class="k">def</span> <span class="nf">check_omfpanel_inputs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check OMF panel inputs</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">check_inputs</span><span class="p">()</span>  
+       </div>
+<div class="viewcode-block" id="SasGenWindow.set_main_panel_sld_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.set_main_panel_sld_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_main_panel_sld_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sld_data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_data</span> <span class="o">=</span> <span class="n">sld_data</span>
+        </div>
+<div class="viewcode-block" id="SasGenWindow.set_file_location"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.set_file_location">[docs]</a>    <span class="k">def</span> <span class="nf">set_file_location</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        File location</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">path</span>
+    </div>
+<div class="viewcode-block" id="SasGenWindow.get_path"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.get_path">[docs]</a>    <span class="k">def</span> <span class="nf">get_path</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        File location</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span>
+    </div>
+<div class="viewcode-block" id="SasGenWindow.draw_graph"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.draw_graph">[docs]</a>    <span class="k">def</span> <span class="nf">draw_graph</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">plot</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span> 
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">plot</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">))</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c"># standalone</span>
+            <span class="n">frame</span> <span class="o">=</span> <span class="n">PlotFrame</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;testView&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">scale2d</span><span class="p">)</span>
+            <span class="c">#add_icon(self.parent, frame)</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">add_plot</span><span class="p">(</span><span class="n">plot</span><span class="p">)</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="n">title</span><span class="p">)</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="SasGenWindow.set_schedule_full_draw"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.set_schedule_full_draw">[docs]</a>    <span class="k">def</span> <span class="nf">set_schedule_full_draw</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">panel</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">func</span><span class="o">=</span><span class="s">&#39;del&#39;</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Send full draw to gui frame</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_schedule_full_draw</span><span class="p">(</span><span class="n">panel</span><span class="p">,</span> <span class="n">func</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="SasGenWindow.get_npix"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.get_npix">[docs]</a>    <span class="k">def</span> <span class="nf">get_npix</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get no. of pixels from omf panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">n_pix</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">npix_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">n_pix</span>
+    </div>
+<div class="viewcode-block" id="SasGenWindow.get_pix_volumes"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.get_pix_volumes">[docs]</a>    <span class="k">def</span> <span class="nf">get_pix_volumes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get a pixel volume</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">vol</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">get_pix_volumes</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">vol</span>
+    </div>
+<div class="viewcode-block" id="SasGenWindow.set_volume_ctr_val"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.set_volume_ctr_val">[docs]</a>    <span class="k">def</span> <span class="nf">set_volume_ctr_val</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">val</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set volume txtctl value</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">set_volume_ctl_val</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">val</span><span class="p">))</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">print</span> <span class="s">&quot;self.panel is not initialized yet&quot;</span>
+            </div>
+<div class="viewcode-block" id="SasGenWindow.set_omfpanel_default_shap"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.set_omfpanel_default_shap">[docs]</a>    <span class="k">def</span> <span class="nf">set_omfpanel_default_shap</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">shape</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set default_shape in omfpanel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">default_shape</span> <span class="o">=</span> <span class="n">shape</span>
+    </div>
+<div class="viewcode-block" id="SasGenWindow.set_etime"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.set_etime">[docs]</a>    <span class="k">def</span> <span class="nf">set_etime</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Sets est. computation time on panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">set_est_time</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="SasGenWindow.get_sld_data_from_omf"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.get_sld_data_from_omf">[docs]</a>    <span class="k">def</span> <span class="nf">get_sld_data_from_omf</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">get_sld_val</span><span class="p">()</span> 
+        <span class="k">return</span> <span class="n">data</span>
+       </div>
+<div class="viewcode-block" id="SasGenWindow.set_scale2d"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.set_scale2d">[docs]</a>    <span class="k">def</span> <span class="nf">set_scale2d</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">scale</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">scale2d</span> <span class="o">=</span> <span class="n">scale</span>
+            </div>
+<div class="viewcode-block" id="SasGenWindow.on_panel_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.on_panel_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_panel_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Not implemented</span>
+          </div>
+<div class="viewcode-block" id="SasGenWindow.on_open_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.on_open_file">[docs]</a>    <span class="k">def</span> <span class="nf">on_open_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Open</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">on_load_data</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="SasGenWindow.sld_draw"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.sld_draw">[docs]</a>    <span class="k">def</span> <span class="nf">sld_draw</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        sld draw</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">sld_draw</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">has_arrow</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="SasGenWindow.on_save_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.on_save_file">[docs]</a>    <span class="k">def</span> <span class="nf">on_save_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Close</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">omfpanel</span><span class="o">.</span><span class="n">on_save</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="SasGenWindow.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Close</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="o">.</span><span class="n">gen_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="SasGenWindow.on_help"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.gen_scatter_panel.SasGenWindow.on_help">[docs]</a>    <span class="k">def</span> <span class="nf">on_help</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>    
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Gen scatter angle help panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">sas.perspectives.calculator.help_panel</span> <span class="kn">import</span>  <span class="n">HelpWindow</span>
+        <span class="c"># Get models help model_function path</span>
+        <span class="kn">import</span> <span class="nn">sas.perspectives.calculator</span> <span class="kn">as</span> <span class="nn">calmedia</span>
+
+        <span class="n">media</span> <span class="o">=</span> <span class="n">calmedia</span><span class="o">.</span><span class="n">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&#39;media&#39;</span><span class="p">)</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">media</span><span class="p">,</span><span class="s">&quot;gen_sas_help.html&quot;</span><span class="p">)</span> 
+        <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;Generic Scattering Calculator&quot;</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">HelpWindow</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                           <span class="n">title</span><span class="o">=</span><span class="s">&#39; Help: GenSAS&#39;</span><span class="p">,</span>  
+                           <span class="n">pageToOpen</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">865</span><span class="p">,</span> <span class="mi">450</span><span class="p">))</span>   
+        <span class="k">try</span><span class="p">:</span> 
+            <span class="n">frame</span><span class="o">.</span><span class="n">splitter</span><span class="o">.</span><span class="n">DetachWindow</span><span class="p">(</span><span class="n">frame</span><span class="o">.</span><span class="n">lpanel</span><span class="p">)</span>
+            <span class="c"># Display only the right side one</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">lpanel</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span> 
+            <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">add_icon</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">frame</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span> 
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;Display Error</span><span class="se">\n</span><span class="s">&#39;</span>
+            <span class="n">info</span> <span class="o">=</span> <span class="s">&quot;Info&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="p">)</span>
+           </div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">app</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">PySimpleApp</span><span class="p">()</span>
+    <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span>
+    <span class="n">SGframe</span> <span class="o">=</span> <span class="n">SasGenWindow</span><span class="p">()</span>    
+    <span class="n">SGframe</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>     
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/help_panel.html
===================================================================
--- _modules/sas/perspectives/calculator/help_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/help_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,225 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.help_panel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.help_panel</h1><div class="highlight"><pre>
+<span class="c">#!/usr/bin/python</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Help panel for calculator</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">wx.html</span> <span class="kn">as</span> <span class="nn">html</span>
+<span class="kn">from</span> <span class="nn">wx.lib.splitter</span> <span class="kn">import</span> <span class="n">MultiSplitterWindow</span>
+<span class="kn">import</span> <span class="nn">sas.perspectives.calculator</span> <span class="kn">as</span> <span class="nn">calculator</span>
+
+
+<div class="viewcode-block" id="HelpWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.help_panel.HelpWindow">[docs]</a><span class="k">class</span> <span class="nc">HelpWindow</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Tool Help&quot;</span><span class="p">,</span> <span class="n">pageToOpen</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                                                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">700</span><span class="p">,</span> <span class="mi">450</span><span class="p">)):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">             contains help info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="n">title</span><span class="p">)</span> 
+        <span class="n">splitter</span> <span class="o">=</span> <span class="n">MultiSplitterWindow</span><span class="p">(</span><span class="bp">self</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">SP_LIVE_UPDATE</span><span class="p">)</span>
+        <span class="n">rpanel</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">splitter</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lpanel</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">splitter</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">BORDER_SUNKEN</span><span class="p">)</span>
+        
+        <span class="n">vbox</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>
+        <span class="n">header</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">rpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">header</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;#6666FF&#39;</span><span class="p">)</span>
+        <span class="n">header</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;WHITE&#39;</span><span class="p">)</span>
+        <span class="n">hbox</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>
+        <span class="n">st</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">header</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Contents&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="n">font</span> <span class="o">=</span> <span class="n">st</span><span class="o">.</span><span class="n">GetFont</span><span class="p">()</span>
+        <span class="n">font</span><span class="o">.</span><span class="n">SetPointSize</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">st</span><span class="o">.</span><span class="n">SetFont</span><span class="p">(</span><span class="n">font</span><span class="p">)</span>
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">st</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">header</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">hbox</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">header</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">EXPAND</span><span class="p">)</span>
+       
+        <span class="n">vboxl</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>
+        <span class="n">headerl</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="bp">self</span><span class="o">.</span><span class="n">lpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+       
+        <span class="n">headerl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;#6666FF&#39;</span><span class="p">)</span>
+        <span class="n">headerl</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;WHITE&#39;</span><span class="p">)</span>
+        <span class="n">hboxl</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>
+        <span class="n">lst</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">headerl</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Menu&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="n">fontl</span> <span class="o">=</span> <span class="n">lst</span><span class="o">.</span><span class="n">GetFont</span><span class="p">()</span>
+        <span class="n">fontl</span><span class="o">.</span><span class="n">SetPointSize</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">lst</span><span class="o">.</span><span class="n">SetFont</span><span class="p">(</span><span class="n">fontl</span><span class="p">)</span>
+        <span class="n">hboxl</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">lst</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">headerl</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">hboxl</span><span class="p">)</span>
+        <span class="n">vboxl</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">headerl</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">EXPAND</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lhelp</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlWindow</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">lpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">NO_BORDER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlWindow</span><span class="p">(</span><span class="n">rpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">NO_BORDER</span><span class="p">,</span> 
+                                     <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">500</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="k">if</span> <span class="n">pageToOpen</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">pageToOpen</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="s">&quot;gen_sas_help.html&quot;</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">path</span> <span class="o">=</span> <span class="n">calculator</span><span class="o">.</span><span class="n">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&#39;media&#39;</span><span class="p">)</span>
+       
+        <span class="n">page1</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;&lt;html&gt;</span>
+<span class="s">            &lt;body&gt;</span>
+<span class="s">             &lt;p&gt;Select topic on Menu&lt;/p&gt;</span>
+<span class="s">            &lt;/body&gt;</span>
+<span class="s">            &lt;/html&gt;&quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">SetPage</span><span class="p">(</span><span class="n">page1</span><span class="p">)</span>
+        <span class="n">page</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;&lt;html&gt;</span>
+<span class="s">            &lt;body&gt;</span>
+<span class="s">            &lt;ul&gt;</span>
+<span class="s">            &lt;li&gt;&lt;a href =&quot;data_operator_help.html&quot; </span>
+<span class="s">            target =&quot;showframe&quot;&gt;Data Operator&lt;/a&gt;&lt;br&gt;&lt;/li&gt;</span>
+<span class="s">            &lt;li&gt;&lt;a href =&quot;sld_calculator_help.html&quot; </span>
+<span class="s">            target =&quot;showframe&quot;&gt;SLD Calculator&lt;/a&gt;&lt;br&gt;&lt;/li&gt;</span>
+<span class="s">            &lt;li&gt;&lt;a href =&quot;density_calculator_help.html&quot; </span>
+<span class="s">            target =&quot;showframe&quot;&gt;Density Calculator&lt;/a&gt;&lt;br&gt;&lt;/li&gt;</span>
+<span class="s">            &lt;li&gt;&lt;a href =&quot;slit_calculator_help.html&quot; </span>
+<span class="s">            target =&quot;showframe&quot;&gt;Slit Size Calculator&lt;/a&gt;&lt;br&gt;&lt;/li&gt;</span>
+<span class="s">            &lt;li&gt;&lt;a href =&quot;kiessig_calculator_help.html&quot; </span>
+<span class="s">            target =&quot;showframe&quot;&gt;Kiessig Thickness Calculator&lt;/a&gt;&lt;br&gt;&lt;/li&gt;</span>
+<span class="s">            &lt;li&gt;&lt;a href =&quot;resolution_calculator_help.html&quot; </span>
+<span class="s">            target =&quot;showframe&quot;&gt;Resolution Estimator&lt;/a&gt;&lt;br&gt;&lt;/li&gt;</span>
+<span class="s">            &lt;li&gt;&lt;a href =&quot;gen_sas_help.html&quot; </span>
+<span class="s">            target =&quot;showframe&quot;&gt;Generic Scattering Calculator&lt;/a&gt;&lt;br&gt;&lt;/li&gt;</span>
+<span class="s">            &lt;li&gt;&lt;a href =&quot;pycrust_help.html&quot; </span>
+<span class="s">            target =&quot;showframe&quot;&gt;Python Shell&lt;/a&gt;&lt;br&gt;&lt;/li&gt;</span>
+<span class="s">            &lt;li&gt;&lt;a href =&quot;load_image_help.html&quot; </span>
+<span class="s">            target =&quot;showframe&quot;&gt;Image Viewer&lt;/a&gt;&lt;br&gt;&lt;/li&gt;</span>
+<span class="s">            &lt;/ul&gt;</span>
+<span class="s">            &lt;/body&gt;</span>
+<span class="s">            &lt;/html&gt;&quot;&quot;&quot;</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">lhelp</span><span class="o">.</span><span class="n">SetPage</span><span class="p">(</span><span class="n">page</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lhelp</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">html</span><span class="o">.</span><span class="n">EVT_HTML_LINK_CLICKED</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnLinkClicked</span><span class="p">)</span>
+        <span class="k">if</span>  <span class="n">pageToOpen</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">LoadPage</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">pageToOpen</span><span class="p">))</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+        <span class="n">vboxl</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">lhelp</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+        <span class="n">rpanel</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lpanel</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vboxl</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lpanel</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        
+        <span class="n">vbox1</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>
+        <span class="n">vbox1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">splitter</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+        <span class="n">splitter</span><span class="o">.</span><span class="n">AppendWindow</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">lpanel</span><span class="p">,</span> <span class="mi">200</span><span class="p">)</span>
+        <span class="n">splitter</span><span class="o">.</span><span class="n">AppendWindow</span><span class="p">(</span><span class="n">rpanel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox1</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">splitter</span> <span class="o">=</span> <span class="n">splitter</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="HelpWindow.OnLinkClicked"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.help_panel.HelpWindow.OnLinkClicked">[docs]</a>    <span class="k">def</span> <span class="nf">OnLinkClicked</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Function to diplay html page related to the hyperlinktext selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">link</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetLinkInfo</span><span class="p">()</span><span class="o">.</span><span class="n">GetHref</span><span class="p">()</span>
+        <span class="n">link</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">path</span><span class="p">,</span> <span class="n">link</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">LoadPage</span><span class="p">(</span><span class="n">link</span><span class="p">)</span>
+        
+        </div></div>
+<div class="viewcode-block" id="ViewApp"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.help_panel.ViewApp">[docs]</a><span class="k">class</span> <span class="nc">ViewApp</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">):</span>
+<div class="viewcode-block" id="ViewApp.OnInit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.help_panel.ViewApp.OnInit">[docs]</a>    <span class="k">def</span> <span class="nf">OnInit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">HelpWindow</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;HelpWindow&#39;</span><span class="p">)</span>    
+        <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTopWindow</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">True</span>
+        </div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">app</span> <span class="o">=</span> <span class="n">ViewApp</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>     
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/image_viewer.html
===================================================================
--- _modules/sas/perspectives/calculator/image_viewer.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/image_viewer.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,559 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.image_viewer &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.image_viewer</h1><div class="highlight"><pre>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
+<span class="kn">import</span> <span class="nn">matplotlib</span>
+<span class="n">matplotlib</span><span class="o">.</span><span class="n">interactive</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+<span class="c">#Use the WxAgg back end. The Wx one takes too long to render</span>
+<span class="n">matplotlib</span><span class="o">.</span><span class="n">use</span><span class="p">(</span><span class="s">&#39;WXAgg&#39;</span><span class="p">)</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.local_perspectives.plotting.SimplePlot</span> <span class="kn">import</span> <span class="n">PlotFrame</span>
+<span class="c">#import matplotlib.pyplot as plt</span>
+<span class="kn">import</span> <span class="nn">matplotlib.image</span> <span class="kn">as</span> <span class="nn">mpimg</span>
+<span class="kn">import</span> <span class="nn">matplotlib.colors</span> <span class="kn">as</span> <span class="nn">colors</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.calculator_widgets</span> <span class="kn">import</span> <span class="n">InputTextCtrl</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Data2D</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Detector</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.manipulations</span> <span class="kn">import</span> <span class="n">reader2D_converter</span>
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">60</span>
+<span class="n">IS_WIN</span> <span class="o">=</span> <span class="bp">True</span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">_DIALOG_WIDTH</span> <span class="o">=</span> <span class="mi">400</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_DIALOG_WIDTH</span> <span class="o">=</span> <span class="mi">480</span>
+    <span class="n">IS_WIN</span> <span class="o">=</span> <span class="bp">False</span>
+
+<div class="viewcode-block" id="ImageView"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.image_viewer.ImageView">[docs]</a><span class="k">class</span> <span class="nc">ImageView</span><span class="p">:</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Open a file dialog to allow the user to select a given file.</span>
+<span class="sd">    Display the loaded data if available.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Init</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        
+<div class="viewcode-block" id="ImageView.load"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.image_viewer.ImageView.load">[docs]</a>    <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        load image files</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span>
+        <span class="k">if</span> <span class="n">parent</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">location</span> <span class="o">=</span> <span class="n">parent</span><span class="o">.</span><span class="n">_default_save_location</span>
+        <span class="n">path_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">choose_data_file</span><span class="p">(</span><span class="n">location</span><span class="o">=</span><span class="n">location</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">path_list</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">path_list</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">0</span> <span class="ow">and</span> <span class="ow">not</span><span class="p">(</span><span class="n">path_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="ow">is</span> <span class="bp">None</span><span class="p">):</span>
+            <span class="k">if</span> <span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">parent</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">path_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="n">err_msg</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="k">for</span> <span class="n">file_path</span> <span class="ow">in</span> <span class="n">path_list</span><span class="p">:</span>
+            <span class="n">basename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">file_path</span><span class="p">)</span>
+            <span class="n">_</span><span class="p">,</span> <span class="n">extension</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">img</span> <span class="o">=</span> <span class="n">mpimg</span><span class="o">.</span><span class="n">imread</span><span class="p">(</span><span class="n">file_path</span><span class="p">)</span>
+                <span class="n">is_png</span> <span class="o">=</span> <span class="n">extension</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;.png&#39;</span>
+                <span class="n">plot_frame</span> <span class="o">=</span> <span class="n">ImageFrame</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">basename</span><span class="p">,</span> <span class="n">img</span><span class="p">)</span>
+                <span class="n">plot_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="c">#plot_frame.im_show(img)</span>
+                <span class="n">ax</span> <span class="o">=</span> <span class="n">plot_frame</span><span class="o">.</span><span class="n">plotpanel</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">is_png</span><span class="p">:</span>
+                    <span class="n">ax</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">set_ylim</span><span class="p">(</span><span class="n">ax</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">get_ylim</span><span class="p">()[::</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
+                <span class="n">ax</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">set_xlabel</span><span class="p">(</span><span class="s">&#39;x [pixel]&#39;</span><span class="p">)</span>
+                <span class="n">ax</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s">&#39;y [pixel]&#39;</span><span class="p">)</span>
+                <span class="n">ax</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">subplots_adjust</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="mf">0.15</span><span class="p">,</span> <span class="n">bottom</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> 
+                                          <span class="n">right</span><span class="o">=</span><span class="mf">0.95</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.95</span><span class="p">)</span>
+                <span class="n">plot_frame</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="s">&#39;Picture -- </span><span class="si">%s</span><span class="s"> --&#39;</span><span class="o">%</span> <span class="n">basename</span><span class="p">)</span>
+                <span class="n">plot_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">parent</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="n">plot_frame</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">print</span> <span class="s">&quot;parent&quot;</span><span class="p">,</span> <span class="n">parent</span>
+                <span class="k">raise</span>
+                <span class="n">err_msg</span> <span class="o">+=</span> <span class="s">&quot;Failed to load &#39;</span><span class="si">%s</span><span class="s">&#39;.</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="n">basename</span>
+        <span class="k">if</span> <span class="n">err_msg</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">err_msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">print</span> <span class="n">err_msg</span>
+
+        </div>
+<div class="viewcode-block" id="ImageView.choose_data_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.image_viewer.ImageView.choose_data_file">[docs]</a>    <span class="k">def</span> <span class="nf">choose_data_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Open a file dialog to allow loading a file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">location</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>
+        <span class="n">wlist</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="n">elist</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;All images (*.png, *.bmp, *.gif, *.jpg, *.tif, *.tiff) | </span><span class="se">\</span>
+<span class="s">                *.png; *.bmp; *.gif; *.jpg; *.tif; *.tiff&quot;</span><span class="p">,</span> 
+                <span class="s">&quot;PNG files (*.PNG, *.png) | *.png&quot;</span><span class="p">,</span> 
+                <span class="s">&quot;BMP files (*.BMP, *.bmp) | *.bmp&quot;</span><span class="p">,</span> 
+                <span class="s">&quot;GIF files (*.GIF, *.gif) | *.gif&quot;</span><span class="p">,</span>
+                <span class="s">&quot;JPG files (*.JPG, *.jpg) | *.jpg&quot;</span><span class="p">,</span>
+                <span class="s">&quot;TIF files (*.TIF, *.tif) | *.tif&quot;</span><span class="p">,</span>
+                <span class="s">&quot;TIFF files (*.TIFF, *.tiff) | *.tiff&quot;</span><span class="p">]</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">IS_WIN</span><span class="p">:</span>
+            <span class="k">del</span> <span class="n">elist</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">elist</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&quot;All files (*.*) | *.*&quot;</span><span class="p">)</span>
+        <span class="n">wlist</span> <span class="o">=</span> <span class="s">&#39;|&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">elist</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">OPEN</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">FD_MULTIPLE</span>
+        <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">parent</span><span class="p">,</span> <span class="s">&quot;Image Viewer: Choose a image file&quot;</span><span class="p">,</span> 
+                            <span class="n">location</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">,</span> <span class="n">wlist</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">style</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPaths</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">path</span>
+</div></div>
+<div class="viewcode-block" id="ImageFrame"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.image_viewer.ImageFrame">[docs]</a><span class="k">class</span> <span class="nc">ImageFrame</span><span class="p">(</span><span class="n">PlotFrame</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Frame for simple plot</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="n">image</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="s">&#39;log_{10}&#39;</span><span class="p">,</span> 
+                 <span class="n">size</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">Size</span><span class="p">(</span><span class="mi">550</span><span class="p">,</span> <span class="mi">470</span><span class="p">)):</span> 
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        comment</span>
+<span class="sd">        :Param data: image array got from imread() of matplotlib [narray]</span>
+<span class="sd">        :param parent: parent panel/container</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Initialize the Frame object</span>
+        <span class="n">PlotFrame</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="n">scale</span><span class="p">,</span> <span class="n">size</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">image</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">file_name</span> <span class="o">=</span> <span class="n">title</span>
+                   
+        <span class="n">menu</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MenuItem</span><span class="p">(</span><span class="n">menu</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;&amp;Convert to Data&quot;</span><span class="p">)</span>
+        <span class="n">menu</span><span class="o">.</span><span class="n">AppendItem</span><span class="p">(</span><span class="n">item</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_set_data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu_bar</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">menu</span><span class="p">,</span> <span class="s">&quot;&amp;Image&quot;</span><span class="p">)</span>
+
+        <span class="n">menu_help</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MenuItem</span><span class="p">(</span><span class="n">menu_help</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;&amp;HowTo&quot;</span><span class="p">)</span>
+        <span class="n">menu_help</span><span class="o">.</span><span class="n">AppendItem</span><span class="p">(</span><span class="n">item</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_help</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu_bar</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">menu_help</span><span class="p">,</span> <span class="s">&quot;&amp;Help&quot;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetMenuBar</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">menu_bar</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">im_show</span><span class="p">(</span><span class="n">image</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="ImageFrame.on_set_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.image_viewer.ImageFrame.on_set_data">[docs]</a>    <span class="k">def</span> <span class="nf">on_set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Rescale the x y range, make 2D data and send it to data explore</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">file_name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">SetDialog</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">,</span> <span class="n">image</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="ImageFrame.on_help"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.image_viewer.ImageFrame.on_help">[docs]</a>    <span class="k">def</span> <span class="nf">on_help</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>    
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Image Viewer help panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">sas.perspectives.calculator.help_panel</span> <span class="kn">import</span>  <span class="n">HelpWindow</span>
+        <span class="c"># Get models help model_function path</span>
+        <span class="kn">import</span> <span class="nn">sas.perspectives.calculator</span> <span class="kn">as</span> <span class="nn">calmedia</span>
+
+        <span class="n">media</span> <span class="o">=</span> <span class="n">calmedia</span><span class="o">.</span><span class="n">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&#39;media&#39;</span><span class="p">)</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">media</span><span class="p">,</span><span class="s">&quot;load_image_help.html&quot;</span><span class="p">)</span> 
+        <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;Image Viewer&quot;</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">HelpWindow</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&#39; Help: Image Viewer&#39;</span><span class="p">,</span>  
+                           <span class="n">pageToOpen</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">640</span><span class="p">,</span> <span class="mi">450</span><span class="p">))</span>   
+        <span class="k">try</span><span class="p">:</span> 
+            <span class="n">frame</span><span class="o">.</span><span class="n">splitter</span><span class="o">.</span><span class="n">DetachWindow</span><span class="p">(</span><span class="n">frame</span><span class="o">.</span><span class="n">lpanel</span><span class="p">)</span>
+            <span class="c"># Display only the right side one</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">lpanel</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span> 
+            <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span> 
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;Display Error</span><span class="se">\n</span><span class="s">&#39;</span>
+            <span class="n">info</span> <span class="o">=</span> <span class="s">&quot;Info&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="p">)</span>
+            </div></div>
+<div class="viewcode-block" id="SetDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.image_viewer.SetDialog">[docs]</a><span class="k">class</span> <span class="nc">SetDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Dialog for Data Set</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Convert to Data&quot;</span><span class="p">,</span> <span class="n">image</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_DIALOG_WIDTH</span><span class="p">,</span> <span class="mi">270</span><span class="p">)):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="p">)</span>
+        <span class="c"># parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">=</span> <span class="n">parent</span><span class="o">.</span><span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">image</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">image</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_ctrl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">xy_ctrls</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_png</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_is_png</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_build_layout</span><span class="p">()</span>
+        <span class="n">my_title</span> <span class="o">=</span> <span class="s">&quot;Convert Image to Data - </span><span class="si">%s</span><span class="s"> -&quot;</span><span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">title</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="n">my_title</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSize</span><span class="p">(</span><span class="n">size</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_get_is_png</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get if the image file is png</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">_</span><span class="p">,</span> <span class="n">extension</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">title</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">extension</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;.png&#39;</span>
+            
+    <span class="k">def</span> <span class="nf">_build_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Layout</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">vbox</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>
+        <span class="n">zbox</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>
+        <span class="n">xbox</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>
+        <span class="n">ybox</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>
+        <span class="n">btnbox</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>
+        
+        <span class="n">sb_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Transform Axes&#39;</span><span class="p">)</span>
+        <span class="n">boxsizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">sb_title</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">z_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;z values (range: 0 - 255) to:&#39;</span><span class="p">)</span>
+        <span class="n">ztime_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;z *&#39;</span><span class="p">)</span>
+        <span class="n">x_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;x values from pixel # to:&#39;</span><span class="p">)</span>
+        <span class="n">xmin_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;xmin:&#39;</span><span class="p">)</span>
+        <span class="n">xmax_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;xmax:&#39;</span><span class="p">)</span>
+        <span class="n">y_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;y values from pixel # to:&#39;</span><span class="p">)</span>
+        <span class="n">ymin_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;ymin: &#39;</span><span class="p">)</span>
+        <span class="n">ymax_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;ymax:&#39;</span><span class="p">)</span>
+        <span class="n">z_ctl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+        
+        <span class="n">xmin_ctl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+        <span class="n">xmax_ctl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+        <span class="n">ymin_ctl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+        <span class="n">ymax_ctl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+        <span class="n">z_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;1.0&#39;</span><span class="p">)</span>
+        <span class="n">xmin_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;-0.3&#39;</span><span class="p">)</span>
+        <span class="n">xmax_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;0.3&#39;</span><span class="p">)</span>
+        <span class="n">ymin_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;-0.3&#39;</span><span class="p">)</span>
+        <span class="n">ymax_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;0.3&#39;</span><span class="p">)</span>
+        <span class="n">z_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_z_enter</span><span class="p">)</span>
+        <span class="n">xmin_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onparam</span><span class="p">)</span>
+        <span class="n">xmax_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onparam</span><span class="p">)</span>
+        <span class="n">ymin_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onparam</span><span class="p">)</span>
+        <span class="n">ymax_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onparam</span><span class="p">)</span>
+        <span class="n">xbox</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">x_title</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">LEFT</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> 
+                      <span class="p">(</span><span class="n">xmin_title</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span> 
+                      <span class="p">(</span><span class="n">xmin_ctl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span> 
+                      <span class="p">(</span><span class="n">xmax_title</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span> 
+                      <span class="p">(</span><span class="n">xmax_ctl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        <span class="n">ybox</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">y_title</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">LEFT</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> 
+                      <span class="p">(</span><span class="n">ymin_title</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span> 
+                      <span class="p">(</span><span class="n">ymin_ctl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span> 
+                      <span class="p">(</span><span class="n">ymax_title</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span> 
+                      <span class="p">(</span><span class="n">ymax_ctl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>     
+        <span class="n">zbox</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">z_title</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">LEFT</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> 
+                      <span class="p">(</span><span class="n">ztime_title</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                      <span class="p">(</span><span class="n">z_ctl</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">LEFT</span><span class="p">,</span> <span class="mi">7</span><span class="p">),</span> 
+                      <span class="p">])</span>   
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;The data rescaled will show up in the Data Explorer. </span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;*Note: Recommend to use an image with 8 bit Grey </span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;  scale (and with No. of pixels &lt; 300 x 300).</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;  Otherwise, z = 0.299R + 0.587G + 0.114B.&quot;</span>
+        <span class="n">note_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">msg</span><span class="p">)</span>
+        <span class="n">note_txt</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&quot;black&quot;</span><span class="p">)</span>
+        <span class="n">hbox</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>
+        <span class="n">okButton</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;OK&#39;</span><span class="p">)</span>
+        <span class="n">okButton</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_set</span><span class="p">)</span>
+        <span class="n">cancelButton</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Cancel&#39;</span><span class="p">)</span>
+        <span class="n">cancelButton</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnClose</span><span class="p">)</span>
+        <span class="n">btnbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">okButton</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">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">btnbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">cancelButton</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">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">note_txt</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">btnbox</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">15</span><span class="p">))</span>
+        <span class="n">boxsizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">xbox</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">boxsizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ybox</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">boxsizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">zbox</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">hbox</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">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">okButton</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        <span class="c"># set sizer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="c">#pos = self.parent.GetPosition()</span>
+        <span class="c">#self.SetPosition(pos)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_ctrl</span> <span class="o">=</span> <span class="n">z_ctl</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">xy_ctrls</span> <span class="o">=</span> <span class="p">[[</span><span class="n">xmin_ctl</span><span class="p">,</span> <span class="n">xmax_ctl</span><span class="p">],</span> <span class="p">[</span><span class="n">ymin_ctl</span><span class="p">,</span> <span class="n">ymax_ctl</span><span class="p">]]</span>
+
+    <span class="k">def</span> <span class="nf">_onparamEnter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        By pass original txtcrl binding</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">pass</span>    
+        
+    <span class="k">def</span> <span class="nf">_onparam</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set to default</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_check_ctrls</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">_check_ctrls</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">is_button</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">item</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>  
+            <span class="k">if</span> <span class="n">val</span> <span class="o">&lt;</span> <span class="o">-</span><span class="mf">10.0</span> <span class="ow">or</span> <span class="n">val</span> <span class="o">&gt;</span> <span class="mf">10.0</span><span class="p">:</span>
+                <span class="n">item</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">item</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">item</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="n">item</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span> <span class="ow">and</span> <span class="n">is_button</span><span class="p">:</span>
+            <span class="n">err_msg</span> <span class="o">=</span> <span class="s">&quot;The allowed range of the min and max values are </span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">err_msg</span> <span class="o">+=</span> <span class="s">&quot;between -10 and 10.&quot;</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">err_msg</span><span class="p">,</span> 
+                                                    <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">print</span> <span class="n">err_msg</span>
+        <span class="k">return</span> <span class="n">flag</span>
+
+    <span class="k">def</span> <span class="nf">_on_z_enter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span> <span class="bp">None</span><span class="p">):</span> 
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On z factor enter</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_check_z_ctrl</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_check_z_ctrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">is_button</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">item</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>  
+            <span class="k">if</span> <span class="n">val</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">item</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">item</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">item</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="n">item</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span> 
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span> <span class="ow">and</span> <span class="n">is_button</span><span class="p">:</span>
+            <span class="n">err_msg</span> <span class="o">=</span> <span class="s">&quot;The z scale value should be larger than 0.&quot;</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">err_msg</span><span class="p">,</span> 
+                                                    <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">print</span> <span class="n">err_msg</span>
+        <span class="k">return</span> <span class="n">flag</span> 
+    
+<div class="viewcode-block" id="SetDialog.on_set"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.image_viewer.SetDialog.on_set">[docs]</a>    <span class="k">def</span> <span class="nf">on_set</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set image as data   </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="c"># Check the textctrl values</span>
+        <span class="k">for</span> <span class="n">item_list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">xy_ctrls</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">item_list</span><span class="p">:</span>
+                 <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_ctrls</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="bp">True</span><span class="p">):</span>
+                     <span class="k">return</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_z_ctrl</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_ctrl</span><span class="p">,</span> <span class="bp">True</span><span class="p">):</span>
+            <span class="k">return</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">image</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">image</span>
+            <span class="n">xmin</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">xy_ctrls</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="n">xmax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">xy_ctrls</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="n">ymin</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">xy_ctrls</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="n">ymax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">xy_ctrls</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="n">zscale</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_ctrl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">convert_image</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span><span class="p">,</span> <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span><span class="p">,</span> <span class="n">zscale</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">err_msg</span> <span class="o">=</span> <span class="s">&quot;Error occurred while converting Image to Data.&quot;</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">err_msg</span><span class="p">,</span> 
+                                                    <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">print</span> <span class="n">err_msg</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">OnClose</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="SetDialog.convert_image"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.image_viewer.SetDialog.convert_image">[docs]</a>    <span class="k">def</span> <span class="nf">convert_image</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">rgb</span><span class="p">,</span> <span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span><span class="p">,</span> <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span><span class="p">,</span> <span class="n">zscale</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Convert image to data2D</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">x_len</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">rgb</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="n">y_len</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">rgb</span><span class="p">)</span>
+        <span class="n">x_vals</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="n">x_len</span><span class="p">)</span>
+        <span class="n">y_vals</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="n">y_len</span><span class="p">)</span>
+        <span class="c"># Instantiate data object</span>
+        <span class="n">output</span> <span class="o">=</span> <span class="n">Data2D</span><span class="p">()</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">title</span><span class="p">)</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">filename</span>
+        <span class="n">detector</span> <span class="o">=</span> <span class="n">Detector</span><span class="p">()</span>
+        <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">detector</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># Store the sample to detector distance</span>
+        <span class="n">detector</span><span class="o">.</span><span class="n">distance</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">detector</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">detector</span><span class="p">)</span>
+        <span class="c"># Initiazed the output data object</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">zscale</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">rgb2gray</span><span class="p">(</span><span class="n">rgb</span><span class="p">)</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">err_data</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">([</span><span class="n">x_len</span><span class="p">,</span> <span class="n">y_len</span><span class="p">])</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">mask</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">ones</span><span class="p">([</span><span class="n">x_len</span><span class="p">,</span> <span class="n">y_len</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">xbins</span> <span class="o">=</span> <span class="n">x_len</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">ybins</span> <span class="o">=</span> <span class="n">y_len</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">x_bins</span> <span class="o">=</span> <span class="n">x_vals</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">y_bins</span> <span class="o">=</span> <span class="n">y_vals</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">x_vals</span><span class="p">)</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">qy_data</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">y_vals</span><span class="p">)</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">xmin</span> <span class="o">=</span> <span class="n">xmin</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">xmax</span> <span class="o">=</span> <span class="n">xmax</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">ymin</span> <span class="o">=</span> <span class="n">ymin</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">ymax</span> <span class="o">=</span> <span class="n">ymax</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Q_{x}}&#39;</span><span class="p">,</span> <span class="s">&#39;\AA^{-1}&#39;</span><span class="p">)</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Q_{y}}&#39;</span><span class="p">,</span> <span class="s">&#39;\AA^{-1}&#39;</span><span class="p">)</span>
+        <span class="c"># Store loading process information</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;loader&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">title</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot;Reader&quot;</span>
+        <span class="n">output</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">output</span> <span class="o">=</span> <span class="n">reader2D_converter</span><span class="p">(</span><span class="n">output</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="o">.</span><span class="n">create_gui_data</span><span class="p">(</span><span class="n">output</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">title</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="o">.</span><span class="n">add_data</span><span class="p">({</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">:</span><span class="n">data</span><span class="p">})</span>
+            </div>
+<div class="viewcode-block" id="SetDialog.rgb2gray"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.image_viewer.SetDialog.rgb2gray">[docs]</a>    <span class="k">def</span> <span class="nf">rgb2gray</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">rgb</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        RGB to Grey</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_png</span><span class="p">:</span>
+            <span class="c"># png image limits: 0 to 1, others 0 to 255</span>
+            <span class="c">#factor = 255.0</span>
+            <span class="n">rgb</span> <span class="o">=</span> <span class="n">rgb</span><span class="p">[::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">rgb</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+            <span class="n">grey</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">rollaxis</span><span class="p">(</span><span class="n">rgb</span><span class="p">,</span> <span class="n">axis</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">red</span><span class="p">,</span> <span class="n">green</span><span class="p">,</span> <span class="n">blue</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">rollaxis</span><span class="p">(</span><span class="n">rgb</span><span class="p">[</span><span class="o">...</span><span class="p">,:</span><span class="mi">3</span><span class="p">],</span> <span class="n">axis</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+            <span class="n">grey</span> <span class="o">=</span> <span class="mf">0.299</span> <span class="o">*</span> <span class="n">red</span> <span class="o">+</span> <span class="mf">0.587</span> <span class="o">*</span> <span class="n">green</span> <span class="o">+</span> <span class="mf">0.114</span> <span class="o">*</span> <span class="n">blue</span>
+        <span class="n">max_i</span> <span class="o">=</span> <span class="n">rgb</span><span class="o">.</span><span class="n">max</span><span class="p">()</span>
+        <span class="n">factor</span> <span class="o">=</span> <span class="mf">255.0</span> <span class="o">/</span> <span class="n">max_i</span>
+        <span class="n">grey</span> <span class="o">*=</span> <span class="n">factor</span> 
+        <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">grey</span><span class="p">)</span>
+                      </div>
+<div class="viewcode-block" id="SetDialog.OnClose"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.image_viewer.SetDialog.OnClose">[docs]</a>    <span class="k">def</span> <span class="nf">OnClose</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Close event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># clear event</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+                       </div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>
+    <span class="n">app</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">()</span>
+    <span class="n">ImageView</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span><span class="o">.</span><span class="n">load</span><span class="p">()</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>   
+    
+ 
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/kiessig_calculator_panel.html
===================================================================
--- _modules/sas/perspectives/calculator/kiessig_calculator_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/kiessig_calculator_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,316 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.kiessig_calculator_panel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.kiessig_calculator_panel</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">This software was developed by the University of Tennessee as part of the</span>
+<span class="sd">Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="sd">project funded by the US National Science Foundation. </span>
+
+<span class="sd">See the license text in license.txt</span>
+
+<span class="sd">copyright 2008, 2009, University of Tennessee</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span>
+<span class="kn">from</span> <span class="nn">sas.calculator.kiessig_calculator</span> <span class="kn">import</span> <span class="n">KiessigThicknessCalculator</span> 
+<span class="kn">from</span> <span class="nn">calculator_widgets</span> <span class="kn">import</span> <span class="n">OutputTextCtrl</span>
+<span class="kn">from</span> <span class="nn">calculator_widgets</span> <span class="kn">import</span> <span class="n">InputTextCtrl</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator</span> <span class="kn">import</span> <span class="n">calculator_widgets</span> <span class="k">as</span> <span class="n">widget</span>   
+
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">77</span>
+<span class="c">#Slit length panel size </span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">210</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">560</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">230</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+ 
+<div class="viewcode-block" id="KiessigThicknessCalculatorPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.kiessig_calculator_panel.KiessigThicknessCalculatorPanel">[docs]</a><span class="k">class</span> <span class="nc">KiessigThicknessCalculatorPanel</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Panel</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Provides the Kiessig thickness calculator GUI.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal nickname for the window, used by the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;Kiessig Thickness Calculator&quot;</span>
+    <span class="c">## Name to appear on the window title bar</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;Kiessig Thickness Calculator&quot;</span>
+    <span class="c">## Flag to tell the AUI manager to put this panel in the center pane</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">True</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Panel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="c">#Font size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>  
+        <span class="c"># Object that receive status event</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">kiessig</span> <span class="o">=</span> <span class="n">KiessigThicknessCalculator</span><span class="p">()</span>
+        <span class="c">#layout attribute</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+       
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Define the main sizers building to build this application.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_source</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                <span class="nb">str</span><span class="p">(</span><span class="s">&quot;Kiessig Thickness Calculator&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_source</span><span class="p">,</span>
+                                                    <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dq_name_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">thickness_size_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+       
+    <span class="k">def</span> <span class="nf">_layout_dq_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing dq name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the default dq</span>
+        <span class="n">dq_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">kiessig</span><span class="o">.</span><span class="n">get_deltaq</span><span class="p">())</span>
+        <span class="n">dq_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[1/A]&#39;</span><span class="p">)</span>
+        <span class="n">dq_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Kiessig Fringe Width (Delta Q): &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dq_name_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">dq_hint</span> <span class="o">=</span> <span class="s">&quot;Type the Kiessig Fringe Width (Delta Q)&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dq_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">dq_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dq_name_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">dq_hint</span><span class="p">)</span>
+        <span class="c">#control that triggers importing data</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Compute&quot;</span><span class="p">)</span>
+        <span class="n">hint_on_compute</span> <span class="o">=</span> <span class="s">&quot;Compute the diameter/thickness in the real space.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_button</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_on_compute</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_compute</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dq_name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">dq_name_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dq_name_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">dq_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">compute_button</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">LEFT</span><span class="p">,</span> <span class="mi">30</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_layout_thickness_size</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing thickness information</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">thick_unit</span> <span class="o">=</span> <span class="s">&#39;[&#39;</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">kiessig</span><span class="o">.</span><span class="n">get_thickness_unit</span><span class="p">()</span> <span class="o">+</span><span class="s">&#39;]&#39;</span>
+        <span class="n">thickness_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                           <span class="s">&#39;Thickness (or Diameter): &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">thickness_size_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">thickness_size_hint</span> <span class="o">=</span> <span class="s">&quot; Estimated Size in Real Space&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">thickness_size_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">thickness_size_hint</span><span class="p">)</span>
+        <span class="n">thickness_size_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">thick_unit</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">thickness_size_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">thickness_size_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">thickness_size_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">thickness_size_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_hint</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing hint </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;This tool is to approximately estimate &quot;</span>
+        <span class="n">hint_msg</span> <span class="o">+=</span> <span class="s">&quot;the thickness of a layer&quot;</span>
+        <span class="n">hint_msg</span> <span class="o">+=</span> <span class="s">&quot; or the diameter of particles</span><span class="se">\n</span><span class="s"> &quot;</span>
+        <span class="n">hint_msg</span> <span class="o">+=</span> <span class="s">&quot;from the Kiessig fringe width in SAS/NR data.&quot;</span>
+        <span class="n">hint_msg</span> <span class="o">+=</span> <span class="s">&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">hint_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)])</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span><span class="s">&#39;Close&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close this window.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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">LEFT</span><span class="p">,</span> <span class="mi">390</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Draw window content</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_dq_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_thickness_size</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_hint</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">dq_name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">thickness_size_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+<div class="viewcode-block" id="KiessigThicknessCalculatorPanel.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.kiessig_calculator_panel.KiessigThicknessCalculatorPanel.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        close the window containing this panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">Close</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="KiessigThicknessCalculatorPanel.on_compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.kiessig_calculator_panel.KiessigThicknessCalculatorPanel.on_compute">[docs]</a>    <span class="k">def</span> <span class="nf">on_compute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Execute the computation of thickness</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># skip for another event</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">dq</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dq_name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">kiessig</span><span class="o">.</span><span class="n">set_deltaq</span><span class="p">(</span><span class="n">dq</span><span class="p">)</span>
+        <span class="c"># calculate the thickness </span>
+        <span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">kiessig</span><span class="o">.</span><span class="n">compute_thickness</span><span class="p">()</span>
+        <span class="n">thickness</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="n">output</span><span class="p">)</span>
+        <span class="c"># set tcl</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">thickness_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">thickness</span><span class="p">))</span>
+        </div>
+<div class="viewcode-block" id="KiessigThicknessCalculatorPanel.format_number"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.kiessig_calculator_panel.KiessigThicknessCalculatorPanel.format_number">[docs]</a>    <span class="k">def</span> <span class="nf">format_number</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return a float in a standardized, human-readable formatted string </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span> 
+            <span class="n">value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">output</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">return</span> <span class="n">output</span>
+
+        <span class="n">output</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%-7.4g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span>
+        <span class="k">return</span> <span class="n">output</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>   
+    </div>
+    <span class="k">def</span> <span class="nf">_onparamEnter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span> <span class="o">=</span> <span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Text_enter_callback, perform compute</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_compute</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+             </div>
+<div class="viewcode-block" id="KiessigWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.kiessig_calculator_panel.KiessigWindow">[docs]</a><span class="k">class</span> <span class="nc">KiessigWindow</span><span class="p">(</span><span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="p">):</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                 <span class="n">title</span><span class="o">=</span><span class="s">&quot;Kiessig Thickness Calculator&quot;</span><span class="p">,</span>
+                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span><span class="n">PANEL_HEIGHT</span><span class="p">),</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">size</span>
+        <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">KiessigThicknessCalculatorPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</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_CLOSE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetPosition</span><span class="p">((</span><span class="mi">25</span><span class="p">,</span> <span class="mi">160</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="KiessigWindow.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.kiessig_calculator_panel.KiessigWindow.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Close event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">kiessig_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+
+        </div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">app</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">PySimpleApp</span><span class="p">()</span>
+    <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span>
+    <span class="n">frame</span> <span class="o">=</span> <span class="n">KiessigWindow</span><span class="p">()</span>    
+    <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>     
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/load_thread.html
===================================================================
--- _modules/sas/perspectives/calculator/load_thread.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/load_thread.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,185 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.load_thread &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.load_thread</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Thread handler used to load data</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">from</span> <span class="nn">sas.data_util.calcthread</span> <span class="kn">import</span> <span class="n">CalcThread</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.loader</span> <span class="kn">import</span> <span class="n">Loader</span>
+        
+<div class="viewcode-block" id="DataReader"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.load_thread.DataReader">[docs]</a><span class="k">class</span> <span class="nc">DataReader</span><span class="p">(</span><span class="n">CalcThread</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Load a data given a filename</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="n">completefn</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">updatefn</span>   <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">yieldtime</span>  <span class="o">=</span> <span class="mf">0.01</span><span class="p">,</span>
+                 <span class="n">worktime</span>   <span class="o">=</span> <span class="mf">0.01</span>
+                 <span class="p">):</span>
+        <span class="n">CalcThread</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">completefn</span><span class="p">,</span>
+                 <span class="n">updatefn</span><span class="p">,</span>
+                 <span class="n">yieldtime</span><span class="p">,</span>
+                 <span class="n">worktime</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">path</span> <span class="o">=</span> <span class="n">path</span>
+        <span class="c">#Instantiate a loader </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">loader</span> <span class="o">=</span> <span class="n">Loader</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="mi">0</span>  
+        
+<div class="viewcode-block" id="DataReader.isquit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.load_thread.DataReader.isquit">[docs]</a>    <span class="k">def</span> <span class="nf">isquit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">             @raise KeyboardInterrupt: when the thread is interrupted</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">CalcThread</span><span class="o">.</span><span class="n">isquit</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="k">except</span> <span class="ne">KeyboardInterrupt</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">KeyboardInterrupt</span>   
+        
+        </div>
+<div class="viewcode-block" id="DataReader.compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.load_thread.DataReader.compute">[docs]</a>    <span class="k">def</span> <span class="nf">compute</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            read some data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">data</span> <span class="o">=</span>  <span class="bp">self</span><span class="o">.</span><span class="n">loader</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
+        <span class="k">except</span> <span class="ne">KeyboardInterrupt</span><span class="p">:</span>
+            <span class="c"># Thread was interrupted, just proceed and re-raise.</span>
+            <span class="c"># Real code should not print, but this is an example...</span>
+            <span class="k">raise</span>
+        </div></div>
+<div class="viewcode-block" id="GenReader"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.load_thread.GenReader">[docs]</a><span class="k">class</span> <span class="nc">GenReader</span><span class="p">(</span><span class="n">CalcThread</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Load a sld data given a filename</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="n">loader</span><span class="p">,</span> 
+                 <span class="n">completefn</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">updatefn</span>   <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">yieldtime</span>  <span class="o">=</span> <span class="mf">0.01</span><span class="p">,</span>
+                 <span class="n">worktime</span>   <span class="o">=</span> <span class="mf">0.01</span>
+                 <span class="p">):</span>
+        <span class="n">CalcThread</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">completefn</span><span class="p">,</span>
+                 <span class="n">updatefn</span><span class="p">,</span>
+                 <span class="n">yieldtime</span><span class="p">,</span>
+                 <span class="n">worktime</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">path</span> <span class="o">=</span> <span class="n">path</span>
+        <span class="c">#Instantiate a loader </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">loader</span> <span class="o">=</span> <span class="n">loader</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="mi">0</span>  
+        
+<div class="viewcode-block" id="GenReader.isquit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.load_thread.GenReader.isquit">[docs]</a>    <span class="k">def</span> <span class="nf">isquit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">             @raise KeyboardInterrupt: when the thread is interrupted</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">CalcThread</span><span class="o">.</span><span class="n">isquit</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="k">except</span> <span class="ne">KeyboardInterrupt</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">KeyboardInterrupt</span>   
+        
+        </div>
+<div class="viewcode-block" id="GenReader.compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.load_thread.GenReader.compute">[docs]</a>    <span class="k">def</span> <span class="nf">compute</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            read some data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">data</span> <span class="o">=</span>  <span class="bp">self</span><span class="o">.</span><span class="n">loader</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c"># Thread was interrupted, just proceed and re-raise.</span>
+            <span class="c"># Real code should not print, but this is an example...</span>
+            <span class="k">raise</span>
+            </div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/model_editor.html
===================================================================
--- _modules/sas/perspectives/calculator/model_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/model_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,1510 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.model_editor &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.model_editor</h1><div class="highlight"><pre>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation. </span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">math</span>
+<span class="kn">from</span> <span class="nn">wx.py.editwindow</span> <span class="kn">import</span> <span class="n">EditWindow</span>
+
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+    <span class="n">PNL_WIDTH</span> <span class="o">=</span> <span class="mi">450</span>
+    <span class="n">PNL_HITE</span> <span class="o">=</span> <span class="mi">320</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    <span class="n">PNL_WIDTH</span> <span class="o">=</span> <span class="mi">590</span>
+    <span class="n">PNL_HITE</span> <span class="o">=</span> <span class="mi">350</span>
+<span class="n">M_NAME</span> <span class="o">=</span> <span class="s">&#39;Model&#39;</span>
+<span class="n">EDITOR_WIDTH</span> <span class="o">=</span> <span class="mi">800</span>
+<span class="n">EDITOR_HEIGTH</span> <span class="o">=</span> <span class="mi">735</span>
+<span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">55</span>
+
+    
+<span class="k">def</span> <span class="nf">_compileFile</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Compile the file in the path</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="kn">import</span> <span class="nn">py_compile</span>
+        <span class="n">py_compile</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> <span class="n">doraise</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">return</span> <span class="s">&#39;&#39;</span>
+    <span class="k">except</span><span class="p">:</span>
+        <span class="n">_</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_info</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">value</span>
+    
+<span class="k">def</span> <span class="nf">_deleteFile</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Delete file in the path</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+    <span class="k">except</span><span class="p">:</span>
+        <span class="k">raise</span>
+
+ 
+<div class="viewcode-block" id="TextDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog">[docs]</a><span class="k">class</span> <span class="nc">TextDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Dialog for easy custom sum models  </span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> 
+                 <span class="n">model_list</span><span class="o">=</span><span class="p">[],</span> <span class="n">plugin_dir</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Dialog window popup when selecting &#39;Easy Custom Sum/Multiply&#39; </span>
+<span class="sd">        on the menu</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">,</span> 
+                           <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PNL_WIDTH</span><span class="p">,</span> <span class="n">PNL_HITE</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">base</span>
+        <span class="c">#Font</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="c"># default</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">font</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">SystemSettings_GetFont</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">SYS_SYSTEM_FONT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">font</span><span class="o">.</span><span class="n">SetPointSize</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">overwrite_name</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plugin_dir</span> <span class="o">=</span> <span class="n">plugin_dir</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_list</span> <span class="o">=</span> <span class="n">model_list</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model1_string</span> <span class="o">=</span> <span class="s">&quot;SphereModel&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model2_string</span> <span class="o">=</span> <span class="s">&quot;CylinderModel&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">&#39;Sum&#39;</span> <span class="o">+</span> <span class="n">M_NAME</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">factor</span> <span class="o">=</span> <span class="s">&#39;scale_factor&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator</span> <span class="o">=</span> <span class="s">&#39;+&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">explanation</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">explanationctr</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_hsizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model1</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model2</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">static_line_1</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">okButton</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">closeButton</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">msg_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fname</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cm_list</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_p1_custom</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_p2_custom</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_build_sizer</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model1_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model1</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model2_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model2</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">good_name</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_oprator_combox</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for file/function name related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_hsizer</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>
+        <span class="c">#title name [string]</span>
+        <span class="n">name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Function Name : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="o">*</span><span class="mi">3</span><span class="o">/</span><span class="mi">5</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</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="bp">self</span><span class="o">.</span><span class="n">on_change_name</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetFont</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">font</span><span class="p">)</span>
+        <span class="n">hint_name</span> <span class="o">=</span> <span class="s">&quot;Unique Sum/Multiply Model Function Name.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_name</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_hsizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">name_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                             <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_hsizer</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                        <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+        
+    <span class="k">def</span> <span class="nf">_layout_description</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for description related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_sizer</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>
+        <span class="c">#title name [string]</span>
+        <span class="n">desc_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Description (optional) : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="o">*</span><span class="mi">3</span><span class="o">/</span><span class="mi">5</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="c">#self.name_tcl.SetFont(self.font)</span>
+        <span class="n">hint_desc</span> <span class="o">=</span> <span class="s">&quot;Write a short description of this model function.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_desc</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">desc_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">desc_tcl</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>     
+  
+    <span class="k">def</span> <span class="nf">_build_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Build gui</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">box_width</span> <span class="o">=</span> <span class="mi">195</span> <span class="c"># combobox width</span>
+        <span class="n">vbox</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_description</span><span class="p">()</span>
+        
+        
+        <span class="n">sum_description</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Select&#39;</span><span class="p">,</span> 
+                                       <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PNL_WIDTH</span><span class="o">-</span><span class="mi">30</span><span class="p">,</span> <span class="mi">70</span><span class="p">))</span>
+        <span class="n">sum_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">sum_description</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">model1_box</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>
+        <span class="n">model2_box</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>
+        <span class="n">model_vbox</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model1</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_model1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model1</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">box_width</span><span class="o">*</span><span class="mi">5</span><span class="o">/</span><span class="mi">6</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model1</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;model1&quot;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_select_operator</span><span class="p">)</span>
+        <span class="n">operation_tip</span> <span class="o">=</span> <span class="s">&quot;Add: +, Multiply: * &quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">operation_tip</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">model2</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_model2</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model2</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">box_width</span><span class="o">*</span><span class="mi">5</span><span class="o">/</span><span class="mi">6</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model2</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;model2&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_model_list</span><span class="p">()</span>
+        
+         <span class="c"># Buttons on the bottom</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">static_line_1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">okButton</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">,</span> <span class="s">&#39;Apply&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">box_width</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="mi">25</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">okButton</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">check_name</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">closeButton</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span> <span class="s">&#39;Close&#39;</span><span class="p">,</span> 
+                                     <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">box_width</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="mi">25</span><span class="p">))</span>
+        <span class="c"># Intro</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">explanation</span>  <span class="o">=</span> <span class="s">&quot;  custom model = </span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s"> &quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">factor</span><span class="p">,</span> <span class="s">&#39;*&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">explanation</span>  <span class="o">+=</span> <span class="s">&quot;(model1 </span><span class="si">%s</span><span class="s"> model2)</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator</span>
+        <span class="c">#explanation  += &quot;  Note: This will overwrite the previous sum model.\n&quot;</span>
+        <span class="n">model_string</span> <span class="o">=</span> <span class="s">&quot; Model</span><span class="si">%s</span><span class="s"> (p</span><span class="si">%s</span><span class="s">):&quot;</span>
+        <span class="c"># msg</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">msg_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">msg_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</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">LEFT</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_hsizer</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">desc_sizer</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">explanationctr</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">explanation</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">explanationctr</span> <span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span>
+                 <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">model1_box</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">model_string</span><span class="o">%</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)),</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">model1_box</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="n">box_width</span><span class="o">-</span><span class="mi">15</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">model1_box</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">model_string</span><span class="o">%</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">)),</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">model2_box</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">model2_box</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">15</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">model2_box</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">model2_box</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">15</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">model2_box</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">model_vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">model1_box</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">model_vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">model2_box</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sum_box</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">model_vbox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sum_box</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span>
+                  <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">static_line_1</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">EXPAND</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">msg_sizer</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">sizer_button</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>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">okButton</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">closeButton</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>        
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_button</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+         
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        
+<div class="viewcode-block" id="TextDialog.on_change_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.on_change_name">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;white&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="TextDialog.check_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.check_name">[docs]</a>    <span class="k">def</span> <span class="nf">check_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check name if exist already</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">mname</span> <span class="o">=</span> <span class="n">M_NAME</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_name</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="n">list_fnames</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">plugin_dir</span><span class="p">)</span>
+        <span class="c"># fake existing regular model name list</span>
+        <span class="n">m_list</span> <span class="o">=</span> <span class="p">[</span><span class="n">model</span> <span class="o">+</span> <span class="s">&quot;.py&quot;</span> <span class="k">for</span> <span class="n">model</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list</span><span class="p">]</span>
+        <span class="n">list_fnames</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">m_list</span><span class="p">)</span>
+        <span class="c"># function/file name</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">title</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+            <span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator</span>
+            <span class="k">if</span> <span class="n">text</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;+&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">mname</span> <span class="o">=</span> <span class="s">&#39;Sum&#39;</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">mname</span> <span class="o">=</span> <span class="s">&#39;Multi&#39;</span>
+            <span class="n">mname</span> <span class="o">+=</span> <span class="n">M_NAME</span>
+            <span class="n">title</span> <span class="o">=</span> <span class="n">mname</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="n">t_fname</span> <span class="o">=</span> <span class="n">title</span> <span class="o">+</span> <span class="s">&#39;.py&#39;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">overwrite_name</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">t_fname</span> <span class="ow">in</span> <span class="n">list_fnames</span> <span class="ow">and</span> <span class="n">title</span> <span class="o">!=</span> <span class="n">mname</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;pink&#39;</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">good_name</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="n">info</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Name exists already.&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="p">)</span>  
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="n">msg</span>
+                <span class="n">color</span> <span class="o">=</span> <span class="s">&#39;red&#39;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">color</span><span class="p">)</span>
+                <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">good_name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fname</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">plugin_dir</span><span class="p">,</span> <span class="n">t_fname</span><span class="p">)</span>
+        <span class="n">s_title</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">title</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">20</span><span class="p">:</span>
+            <span class="n">s_title</span> <span class="o">=</span> <span class="n">title</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">19</span><span class="p">]</span> <span class="o">+</span> <span class="s">&#39;...&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="s">&quot;Model function (</span><span class="si">%s</span><span class="s">) has been set! </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">s_title</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">good_name</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_apply</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fname</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">good_name</span>
+    </div>
+<div class="viewcode-block" id="TextDialog.on_apply"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.on_apply">[docs]</a>    <span class="k">def</span> <span class="nf">on_apply</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Apply</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">label</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getText</span><span class="p">()</span>
+            <span class="n">fname</span> <span class="o">=</span> <span class="n">path</span>
+            <span class="n">name1</span> <span class="o">=</span> <span class="n">label</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="n">name2</span> <span class="o">=</span> <span class="n">label</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">write_string</span><span class="p">(</span><span class="n">fname</span><span class="p">,</span> <span class="n">name1</span><span class="p">,</span> <span class="n">name2</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">compile_file</span><span class="p">(</span><span class="n">fname</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_custom_combo</span><span class="p">()</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span>
+            <span class="n">info</span> <span class="o">=</span> <span class="s">&#39;Info&#39;</span>
+            <span class="n">color</span> <span class="o">=</span> <span class="s">&#39;blue&#39;</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span><span class="o">=</span> <span class="s">&quot;Easy Custom Sum/Multipy: Error occurred...&quot;</span>
+            <span class="n">info</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+            <span class="n">color</span> <span class="o">=</span> <span class="s">&#39;red&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">color</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span> 
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span> <span class="o">=</span> <span class="n">msg</span><span class="p">,</span> 
+                                                      <span class="n">info</span><span class="o">=</span><span class="n">info</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">raise</span>
+                  </div>
+    <span class="k">def</span> <span class="nf">_set_model_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the list of models</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># list of model names</span>
+        <span class="n">cm_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># models</span>
+        <span class="nb">list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list</span>
+        <span class="c"># custom models</span>
+        <span class="n">al_list</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">plugin_dir</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">c_name</span> <span class="ow">in</span> <span class="n">al_list</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">c_name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;py&#39;</span> <span class="ow">and</span> \
+                    <span class="n">c_name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&#39;__init__&#39;</span><span class="p">:</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">c_name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
+                <span class="n">cm_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">:</span>
+                    <span class="nb">list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cm_list</span> <span class="o">=</span> <span class="n">cm_list</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="nb">list</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">idx</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">)):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model1</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="n">idx</span><span class="p">]),</span> <span class="n">idx</span><span class="p">)</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">model2</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="n">idx</span><span class="p">]),</span> <span class="n">idx</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model1</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model1_string</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model2</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model2_string</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="TextDialog.update_cm_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.update_cm_list">[docs]</a>    <span class="k">def</span> <span class="nf">update_cm_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Update custom model list</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">cm_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">al_list</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">plugin_dir</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">c_name</span> <span class="ow">in</span> <span class="n">al_list</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">c_name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;py&#39;</span> <span class="ow">and</span> \
+                    <span class="n">c_name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&#39;__init__&#39;</span><span class="p">:</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">c_name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
+                <span class="n">cm_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cm_list</span> <span class="o">=</span> <span class="n">cm_list</span> 
+              </div>
+<div class="viewcode-block" id="TextDialog.on_model1"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.on_model1">[docs]</a>    <span class="k">def</span> <span class="nf">on_model1</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set model1</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">update_cm_list</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model1_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model1</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model1_string</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model1_name</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model1_name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">cm_list</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_p1_custom</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_p1_custom</span> <span class="o">=</span> <span class="bp">False</span>
+            </div>
+<div class="viewcode-block" id="TextDialog.on_model2"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.on_model2">[docs]</a>    <span class="k">def</span> <span class="nf">on_model2</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set model2</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">update_cm_list</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model2_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model2</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model2_string</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model2_name</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model2_name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">cm_list</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_p2_custom</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_p2_custom</span> <span class="o">=</span> <span class="bp">False</span>
+        </div>
+<div class="viewcode-block" id="TextDialog.on_select_operator"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.on_select_operator">[docs]</a>    <span class="k">def</span> <span class="nf">on_select_operator</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Select an Operator</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># For Mac</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>    
+        <span class="n">item</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">text</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;*&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="s">&#39;Multi&#39;</span>
+            <span class="n">factor</span> <span class="o">=</span> <span class="s">&#39;BackGround&#39;</span>
+            <span class="n">f_oper</span> <span class="o">=</span> <span class="s">&#39;+&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="s">&#39;Sum&#39;</span>
+            <span class="n">factor</span> <span class="o">=</span> <span class="s">&#39;scale_factor&#39;</span>
+            <span class="n">f_oper</span> <span class="o">=</span> <span class="s">&#39;*&#39;</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">factor</span> <span class="o">=</span> <span class="n">factor</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator</span> <span class="o">=</span> <span class="n">text</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">explanation</span> <span class="o">=</span> <span class="s">&quot;  Custom Model = </span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s"> (model1 </span><span class="si">%s</span><span class="s"> model2)</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> \
+                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">factor</span><span class="p">,</span> <span class="n">f_oper</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">explanationctr</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">explanation</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span> <span class="o">+</span> <span class="n">M_NAME</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+             </div>
+<div class="viewcode-block" id="TextDialog.fill_oprator_combox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.fill_oprator_combox">[docs]</a>    <span class="k">def</span> <span class="nf">fill_oprator_combox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill the current combobox with the operator</span>
+<span class="sd">        &quot;&quot;&quot;</span>   
+        <span class="n">operator_list</span> <span class="o">=</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>
+        <span class="k">for</span> <span class="n">oper</span> <span class="ow">in</span> <span class="n">operator_list</span><span class="p">:</span>
+            <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">oper</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">SetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">oper</span><span class="o">.</span><span class="n">strip</span><span class="p">()))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="TextDialog.getText"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.getText">[docs]</a>    <span class="k">def</span> <span class="nf">getText</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Returns model name string as list</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">model1_name</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model2_name</span><span class="p">]</span>
+    </div>
+<div class="viewcode-block" id="TextDialog.write_string"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.write_string">[docs]</a>    <span class="k">def</span> <span class="nf">write_string</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fname</span><span class="p">,</span> <span class="n">name1</span><span class="p">,</span> <span class="n">name2</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Write and Save file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fname</span> <span class="o">=</span> <span class="n">fname</span>  
+        <span class="n">description</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">desc_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">description</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+            <span class="n">description</span> <span class="o">=</span> <span class="n">name1</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator</span> <span class="o">+</span> <span class="n">name2</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator_cbox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">text</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;+&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">factor</span> <span class="o">=</span> <span class="s">&#39;scale_factor&#39;</span>
+            <span class="n">f_oper</span> <span class="o">=</span> <span class="s">&#39;*&#39;</span>
+            <span class="n">default_val</span> <span class="o">=</span> <span class="s">&#39;1.0&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">factor</span> <span class="o">=</span> <span class="s">&#39;BackGround&#39;</span>
+            <span class="n">f_oper</span> <span class="o">=</span> <span class="s">&#39;+&#39;</span>
+            <span class="n">default_val</span> <span class="o">=</span> <span class="s">&#39;0.0&#39;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fname</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">out_f</span> <span class="o">=</span>  <span class="nb">open</span><span class="p">(</span><span class="n">path</span><span class="p">,</span><span class="s">&#39;w&#39;</span><span class="p">)</span>
+        <span class="k">except</span> <span class="p">:</span>
+            <span class="k">raise</span>
+        <span class="n">lines</span> <span class="o">=</span> <span class="n">SUM_TEMPLATE</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;scale_factor&quot;</span><span class="p">):</span>
+                    <span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&#39;scale_factor&#39;</span><span class="p">,</span> <span class="n">factor</span><span class="p">)</span>
+                    <span class="c">#print &quot;scale_factor&quot;, line</span>
+                <span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;= </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">):</span>
+                    <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">%</span> <span class="p">(</span><span class="n">default_val</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;import Model as P1&quot;</span><span class="p">):</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_p1_custom</span><span class="p">:</span>
+                        <span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">replace</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>
+                        <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">%</span> <span class="n">name1</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;import </span><span class="si">%s</span><span class="s"> as P1&quot;</span><span class="p">):</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_p1_custom</span><span class="p">:</span>
+                        <span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">replace</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>
+                        <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">%</span> <span class="p">(</span><span class="n">name1</span><span class="p">,</span> <span class="n">name1</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;import Model as P2&quot;</span><span class="p">):</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_p2_custom</span><span class="p">:</span>
+                        <span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">replace</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>
+                        <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">%</span> <span class="n">name2</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;import </span><span class="si">%s</span><span class="s"> as P2&quot;</span><span class="p">):</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_p2_custom</span><span class="p">:</span>
+                        <span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">replace</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>
+                        <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">%</span> <span class="p">(</span><span class="n">name2</span><span class="p">,</span> <span class="n">name2</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;self.description = &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span><span class="p">):</span>
+                    <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">%</span> <span class="n">description</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                <span class="c">#elif line.count(&quot;run&quot;) and line.count(&quot;%s&quot;):</span>
+                <span class="c">#    out_f.write(line % self.operator + &quot;\n&quot;)</span>
+                <span class="c">#elif line.count(&quot;evalDistribution&quot;) and line.count(&quot;%s&quot;):</span>
+                <span class="c">#    out_f.write(line % self.operator + &quot;\n&quot;)</span>
+                <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;return&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+                    <span class="c">#print &quot;line return&quot;, line</span>
+                    <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">%</span> <span class="p">(</span><span class="n">f_oper</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;out2&quot;</span><span class="p">)</span><span class="ow">and</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span><span class="p">):</span>
+                    <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">operator</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">raise</span>
+        <span class="n">out_f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+        <span class="c">#else:</span>
+        <span class="c">#    msg = &quot;Name exists already.&quot;</span>
+        </div>
+<div class="viewcode-block" id="TextDialog.compile_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.compile_file">[docs]</a>    <span class="k">def</span> <span class="nf">compile_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Compile the file in the path</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fname</span>
+        <span class="n">_compileFile</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="TextDialog.delete_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.TextDialog.delete_file">[docs]</a>    <span class="k">def</span> <span class="nf">delete_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Delete file in the path</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">_deleteFile</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+
+</div></div>
+<div class="viewcode-block" id="EditorPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorPanel">[docs]</a><span class="k">class</span> <span class="nc">EditorPanel</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ScrolledWindow</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Custom model function editor</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">base</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;name&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;size&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">EDITOR_WIDTH</span><span class="p">,</span> <span class="n">EDITOR_HEIGTH</span><span class="p">)</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;style&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">FULL_REPAINT_ON_RESIZE</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">ScrolledWindow</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="c">#self.SetupScrolling()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">=</span> <span class="n">base</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">path</span> <span class="o">=</span> <span class="n">path</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">font</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">SystemSettings_GetFont</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">SYS_SYSTEM_FONT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">font</span><span class="o">.</span><span class="n">SetPointSize</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">&#39;untitled&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">overwrite_name</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_2d</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fname</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_strings</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">function_strings</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">msg_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">warning</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_description</span> <span class="o">=</span> <span class="s">&quot;New Custom Model&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">function_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#self._default_save_location = os.getcwd()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="c">#self.bt_apply.Disable()</span>
+
+             
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        define initial sizer </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#w, h = self.parent.GetSize()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_hsizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">function_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">func_horizon_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">msg_sizer</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>
+        
+    <span class="k">def</span> <span class="nf">_layout_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for file/function name related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#title name [string]</span>
+        <span class="n">name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Function Name : &#39;</span><span class="p">)</span>  
+        <span class="n">overwrite_cb</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Overwrite?&quot;</span><span class="p">,</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">overwrite_cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">overwrite_cb</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Overwrite it if already exists?&quot;</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="bp">self</span><span class="p">,</span> <span class="n">overwrite_cb</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_over_cb</span><span class="p">)</span>
+        <span class="c">#overwrite_cb.Show(False)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="o">*</span><span class="mi">3</span><span class="o">/</span><span class="mi">5</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</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="bp">self</span><span class="o">.</span><span class="n">on_change_name</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;MyFunction&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetFont</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">font</span><span class="p">)</span>
+        <span class="n">hint_name</span> <span class="o">=</span> <span class="s">&quot;Unique Model Function Name.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_name</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_hsizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="n">overwrite_cb</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">name_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_hsizer</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+        
+    <span class="k">def</span> <span class="nf">_layout_description</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for description related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#title name [string]</span>
+        <span class="n">desc_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Description (optional) : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="o">*</span><span class="mi">3</span><span class="o">/</span><span class="mi">5</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="c">#self.name_tcl.SetFont(self.font)</span>
+        <span class="n">hint_desc</span> <span class="o">=</span> <span class="s">&quot;Write a short description of the model function.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_desc</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">desc_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">desc_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">desc_tcl</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>     
+    <span class="k">def</span> <span class="nf">_layout_param</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for parameter related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">param_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Fit Parameters (if any): &#39;</span><span class="p">)</span> 
+        
+        <span class="n">param_tip</span> <span class="o">=</span> <span class="s">&quot;#Set the parameters and initial values.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">param_tip</span> <span class="o">+=</span> <span class="s">&quot;#Example:</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">param_tip</span> <span class="o">+=</span> <span class="s">&quot;A = 1</span><span class="se">\n</span><span class="s">B = 1&quot;</span>
+        <span class="c">#param_txt.SetToolTipString(param_tip)</span>
+        <span class="nb">id</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_tcl</span> <span class="o">=</span> <span class="n">EditWindow</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">DefaultPosition</span><span class="p">,</span> 
+                            <span class="n">wx</span><span class="o">.</span><span class="n">DefaultSize</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">CLIP_CHILDREN</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">SUNKEN_BORDER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_tcl</span><span class="o">.</span><span class="n">setDisplayLineNumbers</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">param_tip</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">param_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">param_tcl</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+                
+    <span class="k">def</span> <span class="nf">_layout_function</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for function related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">function_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Function(x) : &#39;</span><span class="p">)</span> 
+        <span class="n">hint_function</span> <span class="o">=</span> <span class="s">&quot;#Example:</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">hint_function</span> <span class="o">+=</span> <span class="s">&quot;if x &lt;= 0:</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">hint_function</span> <span class="o">+=</span> <span class="s">&quot;    y = A + B</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">hint_function</span> <span class="o">+=</span> <span class="s">&quot;else:</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">hint_function</span> <span class="o">+=</span> <span class="s">&quot;    y = A + B * cos(2 * pi * x)</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">hint_function</span> <span class="o">+=</span> <span class="s">&quot;return y</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">math_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;*Useful math functions: &#39;</span><span class="p">)</span>
+        <span class="n">math_combo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fill_math_combo</span><span class="p">()</span>
+        
+        <span class="nb">id</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">function_tcl</span> <span class="o">=</span> <span class="n">EditWindow</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">DefaultPosition</span><span class="p">,</span> 
+                            <span class="n">wx</span><span class="o">.</span><span class="n">DefaultSize</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">CLIP_CHILDREN</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">SUNKEN_BORDER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">function_tcl</span><span class="o">.</span><span class="n">setDisplayLineNumbers</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">function_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_function</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">func_horizon_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">function_txt</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">func_horizon_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">math_txt</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">LEFT</span><span class="p">,</span> <span class="mi">250</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">func_horizon_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">math_combo</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">function_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">func_horizon_sizer</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">function_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_tcl</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_msg</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Layout msg</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span><span class="p">,</span> 
+                                      <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">msg_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>  
+                    
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>         
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Apply&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Save changes into the imported data.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_apply</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Close&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close this panel.&quot;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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">LEFT</span><span class="p">,</span> <span class="n">EDITOR_WIDTH</span> <span class="o">*</span> <span class="mf">0.8</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">15</span><span class="p">)])</span>
+          
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw the current panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_description</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_param</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_function</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_msg</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">desc_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">param_sizer</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span>
+                                         <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">function_sizer</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span>
+                                         <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">msg_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">_fill_math_combo</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill up the math combo box</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">math_combo</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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> 
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">dir</span><span class="p">(</span><span class="n">math</span><span class="p">):</span>
+            <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;_&quot;</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="k">exec</span> <span class="s">&quot;float(math.</span><span class="si">%s</span><span class="s">)&quot;</span><span class="o">%</span> <span class="n">item</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">math_combo</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">))</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">math_combo</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;()&quot;</span> <span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">math_combo</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_math_select</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">math_combo</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">math_combo</span>
+        
+    <span class="k">def</span> <span class="nf">_on_math_select</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On math selection on ComboBox</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">label</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">math_combo</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">function_tcl</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        <span class="c"># Put the text at the cursor position</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_tcl</span><span class="o">.</span><span class="n">GetCurrentPos</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">function_tcl</span><span class="o">.</span><span class="n">InsertText</span><span class="p">(</span><span class="n">pos</span><span class="p">,</span> <span class="n">label</span><span class="p">)</span>  
+        <span class="c"># Put the cursor at appropriate postion</span>
+        <span class="n">length</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">label</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">label</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;)&#39;</span><span class="p">:</span>
+            <span class="n">length</span> <span class="o">-=</span> <span class="mi">1</span>
+        <span class="n">f_pos</span> <span class="o">=</span> <span class="n">pos</span> <span class="o">+</span> <span class="n">length</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">function_tcl</span><span class="o">.</span><span class="n">GotoPos</span><span class="p">(</span><span class="n">f_pos</span><span class="p">)</span>   
+
+<div class="viewcode-block" id="EditorPanel.get_notes"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorPanel.get_notes">[docs]</a>    <span class="k">def</span> <span class="nf">get_notes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return notes</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span>
+                 </div>
+<div class="viewcode-block" id="EditorPanel.on_change_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorPanel.on_change_name">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;white&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="EditorPanel.check_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorPanel.check_name">[docs]</a>    <span class="k">def</span> <span class="nf">check_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check name if exist already</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_name</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="n">plugin_dir</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">path</span>
+        <span class="n">list_fnames</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="n">plugin_dir</span><span class="p">)</span>
+        <span class="c"># function/file name</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="n">t_fname</span> <span class="o">=</span> <span class="n">title</span> <span class="o">+</span> <span class="s">&#39;.py&#39;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">overwrite_name</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">t_fname</span> <span class="ow">in</span> <span class="n">list_fnames</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;pink&#39;</span><span class="p">)</span>
+                <span class="k">return</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fname</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">plugin_dir</span><span class="p">,</span> <span class="n">t_fname</span><span class="p">)</span>
+        <span class="n">s_title</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">title</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">20</span><span class="p">:</span>
+            <span class="n">s_title</span> <span class="o">=</span> <span class="n">title</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">19</span><span class="p">]</span> <span class="o">+</span> <span class="s">&#39;...&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Model function name is set &quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;to </span><span class="si">%s</span><span class="s">. </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">s_title</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">True</span>
+    </div>
+<div class="viewcode-block" id="EditorPanel.on_over_cb"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorPanel.on_over_cb">[docs]</a>    <span class="k">def</span> <span class="nf">on_over_cb</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set overwrite name flag on cb event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">cb</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">overwrite_name</span> <span class="o">=</span> <span class="n">cb</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="EditorPanel.on_click_apply"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorPanel.on_click_apply">[docs]</a>    <span class="k">def</span> <span class="nf">on_click_apply</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;   </span>
+<span class="sd">        Changes are saved in data object imported to edit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#must post event here</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">info</span> <span class="o">=</span> <span class="s">&#39;Info&#39;</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="c"># Sort out the errors if occur</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">check_name</span><span class="p">():</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+            <span class="n">description</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">desc_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">param_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_tcl</span><span class="o">.</span><span class="n">GetText</span><span class="p">()</span>
+            <span class="n">func_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_tcl</span><span class="o">.</span><span class="n">GetText</span><span class="p">()</span>
+            <span class="c"># No input for the model function</span>
+            <span class="k">if</span> <span class="n">func_str</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">():</span>     
+                <span class="k">if</span> <span class="n">func_str</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;return&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">write_file</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fname</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">param_str</span><span class="p">,</span> 
+                                                                    <span class="n">func_str</span><span class="p">)</span>
+                    <span class="n">tr_msg</span> <span class="o">=</span> <span class="n">_compileFile</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fname</span><span class="p">)</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">tr_msg</span><span class="o">.</span><span class="n">__str__</span><span class="p">())</span>
+                    <span class="c"># Compile error</span>
+                    <span class="k">if</span> <span class="n">msg</span><span class="p">:</span>
+                        <span class="n">msg</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&quot;  &quot;</span><span class="p">,</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                        <span class="n">msg</span> <span class="o">+=</span>  <span class="s">&quot;</span><span class="se">\n</span><span class="s">Compiling Failed&quot;</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error: The func(x) must &#39;return&#39; a value at least.</span><span class="se">\n</span><span class="s">&quot;</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;For example: </span><span class="se">\n\n</span><span class="s">return 2*x&quot;</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;Error: Function is not defined.&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Name exists already.&quot;</span>
+        <span class="c"># Prepare for the messagebox</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">msg</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="o">.</span><span class="n">update_custom_combo</span><span class="p">()</span>
+            <span class="n">Model</span>  <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">exec</span> <span class="s">&quot;from </span><span class="si">%s</span><span class="s"> import Model&quot;</span><span class="o">%</span> <span class="n">name</span> 
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">Model</span><span class="p">()</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span> 
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error &quot;</span>
+                <span class="n">_</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_info</span><span class="p">()</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;in </span><span class="si">%s</span><span class="s">:</span><span class="se">\n</span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span>  <span class="n">value</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">msg</span><span class="p">:</span>
+            <span class="n">info</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+            <span class="n">color</span> <span class="o">=</span> <span class="s">&#39;red&#39;</span> 
+            <span class="k">try</span><span class="p">:</span>
+                <span class="c"># try to remove pyc file if exists</span>
+                <span class="n">_deleteFile</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fname</span><span class="p">)</span>
+                <span class="n">_deleteFile</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fname</span> <span class="o">+</span> <span class="s">&quot;c&quot;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Successful! &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;  &quot;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; Please look for it in the Customized Models.&quot;</span>
+            <span class="n">info</span> <span class="o">=</span> <span class="s">&#39;Info&#39;</span>
+            <span class="n">color</span> <span class="o">=</span> <span class="s">&#39;blue&#39;</span>
+        <span class="c"># Not to display long error msg</span>
+        <span class="k">if</span> <span class="n">info</span> <span class="o">==</span> <span class="s">&#39;Error&#39;</span><span class="p">:</span>
+            <span class="n">mss</span> <span class="o">=</span> <span class="n">info</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">mss</span> <span class="o">=</span> <span class="n">msg</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">mss</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_msg_box</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">color</span><span class="p">)</span>
+        <span class="c"># Send msg to the top window  </span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span> 
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span> <span class="o">=</span> <span class="n">msg</span><span class="p">,</span> 
+                                                      <span class="n">info</span><span class="o">=</span><span class="n">info</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">warning</span> <span class="o">=</span> <span class="n">msg</span>
+
+                </div>
+<div class="viewcode-block" id="EditorPanel.write_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorPanel.write_file">[docs]</a>    <span class="k">def</span> <span class="nf">write_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fname</span><span class="p">,</span> <span class="n">desc_str</span><span class="p">,</span> <span class="n">param_str</span><span class="p">,</span> <span class="n">func_str</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Write content in file</span>
+<span class="sd">        </span>
+<span class="sd">        :param fname: full file path</span>
+<span class="sd">        :param desc_str: content of the description strings</span>
+<span class="sd">        :param param_str: content of params; Strings  </span>
+<span class="sd">        :param func_str: content of func; Strings</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">out_f</span> <span class="o">=</span>  <span class="nb">open</span><span class="p">(</span><span class="n">fname</span><span class="p">,</span><span class="s">&#39;w&#39;</span><span class="p">)</span>
+        <span class="k">except</span> <span class="p">:</span>
+            <span class="k">raise</span>
+        <span class="c"># Prepare the content of the function</span>
+        <span class="n">lines</span> <span class="o">=</span> <span class="n">CUSTOM_TEMPLATE</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
+
+        <span class="n">has_scipy</span> <span class="o">=</span> <span class="n">func_str</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;scipy.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_2d</span> <span class="o">=</span> <span class="n">func_str</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;#self.ndim = 2&quot;</span><span class="p">)</span>
+        <span class="n">line_2d</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_2d</span><span class="p">:</span>
+            <span class="n">line_2d</span> <span class="o">=</span> <span class="n">CUSTOM_2D_TEMP</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
+        <span class="n">line_test</span> <span class="o">=</span> <span class="n">TEST_TEMPLATE</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
+        <span class="n">local_params</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="n">spaces</span> <span class="o">=</span> <span class="s">&#39;        &#39;</span><span class="c">#8spaces</span>
+        <span class="c"># write function here</span>
+        <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span>
+            <span class="c"># The location where to put the strings is </span>
+            <span class="c"># hard-coded in the template as shown below.</span>
+            <span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;#self.params here&quot;</span><span class="p">):</span>
+                <span class="k">for</span> <span class="n">param_line</span> <span class="ow">in</span> <span class="n">param_str</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">):</span>
+                    <span class="n">p_line</span> <span class="o">=</span> <span class="n">param_line</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="n">p_line</span><span class="p">:</span>
+                        <span class="n">p0_line</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_param_helper</span><span class="p">(</span><span class="n">p_line</span><span class="p">)</span>
+                        <span class="n">local_params</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_function_helper</span><span class="p">(</span><span class="n">p_line</span><span class="p">)</span>
+                        <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">p0_line</span><span class="p">)</span>
+            <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;#local params here&quot;</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">local_params</span><span class="p">:</span>
+                    <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">local_params</span><span class="p">)</span>
+            <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;self.description = &quot;</span><span class="p">):</span>
+                <span class="n">des0</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\\</span><span class="s">n&quot;</span>
+                <span class="n">desc</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">desc_str</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\&quot;</span><span class="s">&#39;</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">))</span>
+                <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span><span class="o">%</span> <span class="p">(</span><span class="n">des0</span> <span class="o">+</span> <span class="n">desc</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+            <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;def function(self, x=0.0</span><span class="si">%s</span><span class="s">):&quot;</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_2d</span><span class="p">:</span>
+                    <span class="n">y_str</span> <span class="o">=</span> <span class="s">&#39;, y=0.0&#39;</span>
+                    <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span><span class="o">%</span> <span class="n">y_str</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span><span class="o">%</span> <span class="s">&#39;&#39;</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+            <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;#function here&quot;</span><span class="p">):</span>
+                <span class="k">for</span> <span class="n">func_line</span> <span class="ow">in</span> <span class="n">func_str</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">):</span>
+                    <span class="n">f_line</span> <span class="o">=</span> <span class="n">func_line</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="n">f_line</span><span class="p">:</span>
+                        <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">spaces</span> <span class="o">+</span> <span class="n">f_line</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">func_str</span><span class="p">:</span>
+                    <span class="n">dep_var</span> <span class="o">=</span> <span class="s">&#39;y&#39;</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_2d</span><span class="p">:</span>
+                        <span class="n">dep_var</span> <span class="o">=</span> <span class="s">&#39;z&#39;</span>
+                    <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">spaces</span> <span class="o">+</span> <span class="s">&#39;return </span><span class="si">%s</span><span class="s">&#39;</span><span class="o">%</span> <span class="n">dep_var</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+            <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;#import scipy?&quot;</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">has_scipy</span><span class="p">:</span>
+                    <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&quot;import scipy&quot;</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+            <span class="c">#elif line.count(&quot;name = &quot;):</span>
+            <span class="c">#    out_f.write(line % self.name + &quot;\n&quot;)</span>
+            <span class="k">elif</span> <span class="n">line</span><span class="p">:</span>
+                <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+        <span class="c"># run string for 2d</span>
+        <span class="k">if</span> <span class="n">line_2d</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">line_2d</span><span class="p">:</span>
+                <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+        <span class="c"># Test strins</span>
+        <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">line_test</span><span class="p">:</span>
+            <span class="n">out_f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">line</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
+   
+        <span class="n">out_f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> 
+    </div>
+<div class="viewcode-block" id="EditorPanel.set_param_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorPanel.set_param_helper">[docs]</a>    <span class="k">def</span> <span class="nf">set_param_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">line</span><span class="p">):</span>   
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get string in line to define the params dictionary</span>
+<span class="sd">        </span>
+<span class="sd">        :param line: one line of string got from the param_str</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">params_str</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="n">spaces</span> <span class="o">=</span> <span class="s">&#39;        &#39;</span><span class="c">#8spaces</span>
+        <span class="n">items</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;;&quot;</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">items</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;=&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;=&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+                <span class="nb">float</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="c"># default</span>
+            <span class="n">params_str</span> <span class="o">+=</span> <span class="n">spaces</span> <span class="o">+</span> <span class="s">&quot;self.params[&#39;</span><span class="si">%s</span><span class="s">&#39;] = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            
+        <span class="k">return</span> <span class="n">params_str</span>
+</div>
+<div class="viewcode-block" id="EditorPanel.set_function_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorPanel.set_function_helper">[docs]</a>    <span class="k">def</span> <span class="nf">set_function_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">line</span><span class="p">):</span>   
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get string in line to define the local params</span>
+<span class="sd">        </span>
+<span class="sd">        :param line: one line of string got from the param_str</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">params_str</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="n">spaces</span> <span class="o">=</span> <span class="s">&#39;        &#39;</span><span class="c">#8spaces</span>
+        <span class="n">items</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;;&quot;</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">items</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;=&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+            <span class="n">params_str</span> <span class="o">+=</span> <span class="n">spaces</span> <span class="o">+</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> = self.params[&#39;</span><span class="si">%s</span><span class="s">&#39;]</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">params_str</span>
+    </div>
+<div class="viewcode-block" id="EditorPanel.get_warning"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorPanel.get_warning">[docs]</a>    <span class="k">def</span> <span class="nf">get_warning</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the warning msg </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">warning</span>
+        </div>
+<div class="viewcode-block" id="EditorPanel.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorPanel.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        leave data as it is and close</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span><span class="c">#Close()</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        </div></div>
+<div class="viewcode-block" id="EditorWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorWindow">[docs]</a><span class="k">class</span> <span class="nc">EditorWindow</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Editor Window</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">base</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> 
+                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">EDITOR_WIDTH</span><span class="p">,</span> <span class="n">EDITOR_HEIGTH</span><span class="p">),</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Init</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;title&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;size&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">size</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">EditorPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> 
+                                 <span class="n">path</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_CLOSE</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnClose</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="EditorWindow.OnClose"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.model_editor.EditorWindow.OnClose">[docs]</a>    <span class="k">def</span> <span class="nf">OnClose</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On close event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="c">#if self.parent != None:</span>
+        <span class="c">#    self.parent.new_model_frame = None</span>
+        <span class="c">#self.Destroy()  </span>
+
+<span class="c">## Templates for custom models</span></div></div>
+<span class="n">CUSTOM_TEMPLATE</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;</span>
+<span class="s">from sas.models.pluginmodel import Model1DPlugin</span>
+<span class="s">from math import *</span>
+<span class="s">import os</span>
+<span class="s">import sys</span>
+<span class="s">import numpy</span>
+<span class="s">#import scipy?</span>
+<span class="s">class Model(Model1DPlugin):</span>
+<span class="s">    name = &quot;&quot;                             </span>
+<span class="s">    def __init__(self):</span>
+<span class="s">        Model1DPlugin.__init__(self, name=self.name)  </span>
+<span class="s">        #set name same as file name </span>
+<span class="s">        self.name = self.get_fname()                                                   </span>
+<span class="s">        #self.params here</span>
+<span class="s">        self.description = &quot;</span><span class="si">%s</span><span class="s">&quot;</span>
+<span class="s">        self.set_details()</span>
+<span class="s">    def function(self, x=0.0</span><span class="si">%s</span><span class="s">):</span>
+<span class="s">        #local params here</span>
+<span class="s">        #function here</span>
+<span class="s">&quot;&quot;&quot;</span>
+<span class="n">CUSTOM_2D_TEMP</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;</span>
+<span class="s">    def run(self, x=0.0, y=0.0):</span>
+<span class="s">        if x.__class__.__name__ == &#39;list&#39;:</span>
+<span class="s">            x_val = x[0]</span>
+<span class="s">            y_val = y[0]*0.0</span>
+<span class="s">            return self.function(x_val, y_val)</span>
+<span class="s">        elif x.__class__.__name__ == &#39;tuple&#39;:</span>
+<span class="s">            msg = &quot;Tuples are not allowed as input to BaseComponent models&quot;</span>
+<span class="s">            raise ValueError, msg</span>
+<span class="s">        else:</span>
+<span class="s">            return self.function(x, 0.0)</span>
+<span class="s">    def runXY(self, x=0.0, y=0.0):</span>
+<span class="s">        if x.__class__.__name__ == &#39;list&#39;:</span>
+<span class="s">            return self.function(x, y)</span>
+<span class="s">        elif x.__class__.__name__ == &#39;tuple&#39;:</span>
+<span class="s">            msg = &quot;Tuples are not allowed as input to BaseComponent models&quot;</span>
+<span class="s">            raise ValueError, msg</span>
+<span class="s">        else:</span>
+<span class="s">            return self.function(x, y)</span>
+<span class="s">    def evalDistribution(self, qdist):</span>
+<span class="s">        if qdist.__class__.__name__ == &#39;list&#39;:</span>
+<span class="s">            msg = &quot;evalDistribution expects a list of 2 ndarrays&quot;</span>
+<span class="s">            if len(qdist)!=2:</span>
+<span class="s">                raise RuntimeError, msg</span>
+<span class="s">            if qdist[0].__class__.__name__ != &#39;ndarray&#39;:</span>
+<span class="s">                raise RuntimeError, msg</span>
+<span class="s">            if qdist[1].__class__.__name__ != &#39;ndarray&#39;:</span>
+<span class="s">                raise RuntimeError, msg</span>
+<span class="s">            v_model = numpy.vectorize(self.runXY, otypes=[float])</span>
+<span class="s">            iq_array = v_model(qdist[0], qdist[1])</span>
+<span class="s">            return iq_array</span>
+<span class="s">        elif qdist.__class__.__name__ == &#39;ndarray&#39;:</span>
+<span class="s">            v_model = numpy.vectorize(self.runXY, otypes=[float])</span>
+<span class="s">            iq_array = v_model(qdist)</span>
+<span class="s">            return iq_array</span>
+<span class="s">&quot;&quot;&quot;</span>
+<span class="n">TEST_TEMPLATE</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;</span>
+<span class="s">    def get_fname(self):</span>
+<span class="s">        path = sys._getframe().f_code.co_filename</span>
+<span class="s">        basename  = os.path.basename(path)</span>
+<span class="s">        name, _ = os.path.splitext(basename)</span>
+<span class="s">        return name</span>
+<span class="s">######################################################################</span>
+<span class="s">## THIS IS FOR TEST. DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       </span>
+<span class="s">if __name__ == &quot;__main__&quot;: </span>
+<span class="s">    m= Model() </span>
+<span class="s">    out1 = m.runXY(0.0)</span>
+<span class="s">    out2 = m.runXY(0.01)</span>
+<span class="s">    isfine1 = numpy.isfinite(out1)</span>
+<span class="s">    isfine2 = numpy.isfinite(out2)</span>
+<span class="s">    print &quot;Testing the value at Q = 0.0:&quot;</span>
+<span class="s">    print out1, &quot; : finite? &quot;, isfine1</span>
+<span class="s">    print &quot;Testing the value at Q = 0.01:&quot;</span>
+<span class="s">    print out2, &quot; : finite? &quot;, isfine2</span>
+<span class="s">    if isfine1 and isfine2:</span>
+<span class="s">        print &quot;===&gt; Simple Test: Passed!&quot;</span>
+<span class="s">    else:</span>
+<span class="s">        print &quot;===&gt; Simple Test: Failed!&quot;</span>
+<span class="s">&quot;&quot;&quot;</span>
+<span class="n">SUM_TEMPLATE</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;</span>
+<span class="s"># A sample of an experimental model function for Sum/Multiply(Pmodel1,Pmodel2)</span>
+<span class="s">import copy</span>
+<span class="s">from sas.models.pluginmodel import Model1DPlugin</span>
+<span class="s"># User can change the name of the model (only with single functional model)</span>
+<span class="s">#P1_model: </span>
+<span class="s">#from sas.models.</span><span class="si">%s</span><span class="s"> import </span><span class="si">%s</span><span class="s"> as P1</span>
+<span class="s">#from </span><span class="si">%s</span><span class="s"> import Model as P1 </span>
+
+<span class="s">#P2_model: </span>
+<span class="s">#from sas.models.</span><span class="si">%s</span><span class="s"> import </span><span class="si">%s</span><span class="s"> as P2</span>
+<span class="s">#from </span><span class="si">%s</span><span class="s"> import Model as P2 </span>
+<span class="s">import os</span>
+<span class="s">import sys</span>
+
+<span class="s">class Model(Model1DPlugin):</span>
+<span class="s">    name = &quot;&quot;</span>
+<span class="s">    def __init__(self):</span>
+<span class="s">        Model1DPlugin.__init__(self, name=&#39;&#39;)</span>
+<span class="s">        p_model1 = P1()</span>
+<span class="s">        p_model2 = P2()</span>
+<span class="s">        ## Setting  model name model description</span>
+<span class="s">        self.description = &#39;</span><span class="si">%s</span><span class="s">&#39;</span>
+<span class="s">        self.name = self.get_fname()</span>
+<span class="s">        if self.name.rstrip().lstrip() == &#39;&#39;:</span>
+<span class="s">            self.name = self._get_name(p_model1.name, p_model2.name)</span>
+<span class="s">        if self.description.rstrip().lstrip() == &#39;&#39;:</span>
+<span class="s">            self.description = p_model1.name</span>
+<span class="s">            self.description += p_model2.name</span>
+<span class="s">            self.fill_description(p_model1, p_model2)</span>
+
+<span class="s">        ## Define parameters</span>
+<span class="s">        self.params = {}</span>
+
+<span class="s">        ## Parameter details [units, min, max]</span>
+<span class="s">        self.details = {}</span>
+<span class="s">        ## Magnetic Panrameters</span>
+<span class="s">        self.magnetic_params = []</span>
+<span class="s">        # non-fittable parameters</span>
+<span class="s">        self.non_fittable = p_model1.non_fittable  </span>
+<span class="s">        self.non_fittable += p_model2.non_fittable  </span>
+<span class="s">            </span>
+<span class="s">        ##models </span>
+<span class="s">        self.p_model1= p_model1</span>
+<span class="s">        self.p_model2= p_model2</span>
+<span class="s">        </span>
+<span class="s">       </span>
+<span class="s">        ## dispersion</span>
+<span class="s">        self._set_dispersion()</span>
+<span class="s">        ## Define parameters</span>
+<span class="s">        self._set_params()</span>
+<span class="s">        ## New parameter:scaling_factor</span>
+<span class="s">        self.params[&#39;scale_factor&#39;] = </span><span class="si">%s</span><span class="s"></span>
+<span class="s">        </span>
+<span class="s">        ## Parameter details [units, min, max]</span>
+<span class="s">        self._set_details()</span>
+<span class="s">        self.details[&#39;scale_factor&#39;] = [&#39;&#39;, None, None]</span>
+
+<span class="s">        </span>
+<span class="s">        #list of parameter that can be fitted</span>
+<span class="s">        self._set_fixed_params()  </span>
+<span class="s">        ## parameters with orientation</span>
+<span class="s">        for item in self.p_model1.orientation_params:</span>
+<span class="s">            new_item = &quot;p1_&quot; + item</span>
+<span class="s">            if not new_item in self.orientation_params:</span>
+<span class="s">                self.orientation_params.append(new_item)</span>
+<span class="s">            </span>
+<span class="s">        for item in self.p_model2.orientation_params:</span>
+<span class="s">            new_item = &quot;p2_&quot; + item</span>
+<span class="s">            if not new_item in self.orientation_params:</span>
+<span class="s">                self.orientation_params.append(new_item)</span>
+<span class="s">        ## magnetic params</span>
+<span class="s">        for item in self.p_model1.magnetic_params:</span>
+<span class="s">            new_item = &quot;p1_&quot; + item</span>
+<span class="s">            if not new_item in self.magnetic_params:</span>
+<span class="s">                self.magnetic_params.append(new_item)</span>
+<span class="s">            </span>
+<span class="s">        for item in self.p_model2.magnetic_params:</span>
+<span class="s">            new_item = &quot;p2_&quot; + item</span>
+<span class="s">            if not new_item in self.magnetic_params:</span>
+<span class="s">                self.magnetic_params.append(new_item)</span>
+<span class="s">        # get multiplicity if model provide it, else 1.</span>
+<span class="s">        try:</span>
+<span class="s">            multiplicity1 = p_model1.multiplicity</span>
+<span class="s">            try:</span>
+<span class="s">                multiplicity2 = p_model2.multiplicity</span>
+<span class="s">            except:</span>
+<span class="s">                multiplicity2 = 1</span>
+<span class="s">        except:</span>
+<span class="s">            multiplicity1 = 1</span>
+<span class="s">            multiplicity2 = 1</span>
+<span class="s">        ## functional multiplicity of the model</span>
+<span class="s">        self.multiplicity1 = multiplicity1  </span>
+<span class="s">        self.multiplicity2 = multiplicity2    </span>
+<span class="s">        self.multiplicity_info = []   </span>
+<span class="s">        </span>
+<span class="s">    def _clone(self, obj):</span>
+<span class="s">        obj.params     = copy.deepcopy(self.params)</span>
+<span class="s">        obj.description     = copy.deepcopy(self.description)</span>
+<span class="s">        obj.details    = copy.deepcopy(self.details)</span>
+<span class="s">        obj.dispersion = copy.deepcopy(self.dispersion)</span>
+<span class="s">        obj.p_model1  = self.p_model1.clone()</span>
+<span class="s">        obj.p_model2  = self.p_model2.clone()</span>
+<span class="s">        #obj = copy.deepcopy(self)</span>
+<span class="s">        return obj</span>
+<span class="s">    </span>
+<span class="s">    def _get_name(self, name1, name2):</span>
+<span class="s">        p1_name = self._get_upper_name(name1)</span>
+<span class="s">        if not p1_name:</span>
+<span class="s">            p1_name = name1</span>
+<span class="s">        name = p1_name</span>
+<span class="s">        name += &quot;_and_&quot;</span>
+<span class="s">        p2_name = self._get_upper_name(name2)</span>
+<span class="s">        if not p2_name:</span>
+<span class="s">            p2_name = name2</span>
+<span class="s">        name += p2_name</span>
+<span class="s">        return name</span>
+<span class="s">    </span>
+<span class="s">    def _get_upper_name(self, name=None):</span>
+<span class="s">        if name == None:</span>
+<span class="s">            return &quot;&quot;</span>
+<span class="s">        upper_name = &quot;&quot;</span>
+<span class="s">        str_name = str(name)</span>
+<span class="s">        for index in range(len(str_name)):</span>
+<span class="s">            if str_name[index].isupper():</span>
+<span class="s">                upper_name += str_name[index]</span>
+<span class="s">        return upper_name</span>
+<span class="s">        </span>
+<span class="s">    def _set_dispersion(self):</span>
+<span class="s">        ##set dispersion only from p_model </span>
+<span class="s">        for name , value in self.p_model1.dispersion.iteritems():</span>
+<span class="s">            #if name.lower() not in self.p_model1.orientation_params:</span>
+<span class="s">            new_name = &quot;p1_&quot; + name</span>
+<span class="s">            self.dispersion[new_name]= value </span>
+<span class="s">        for name , value in self.p_model2.dispersion.iteritems():</span>
+<span class="s">            #if name.lower() not in self.p_model2.orientation_params:</span>
+<span class="s">            new_name = &quot;p2_&quot; + name</span>
+<span class="s">            self.dispersion[new_name]= value </span>
+<span class="s">            </span>
+<span class="s">    def function(self, x=0.0): </span>
+<span class="s">        return 0</span>
+<span class="s">                               </span>
+<span class="s">    def getProfile(self):</span>
+<span class="s">        try:</span>
+<span class="s">            x,y = self.p_model1.getProfile()</span>
+<span class="s">        except:</span>
+<span class="s">            x = None</span>
+<span class="s">            y = None</span>
+<span class="s">            </span>
+<span class="s">        return x, y</span>
+<span class="s">    </span>
+<span class="s">    def _set_params(self):</span>
+<span class="s">        for name , value in self.p_model1.params.iteritems():</span>
+<span class="s">            # No 2D-supported</span>
+<span class="s">            #if name not in self.p_model1.orientation_params:</span>
+<span class="s">            new_name = &quot;p1_&quot; + name</span>
+<span class="s">            self.params[new_name]= value</span>
+<span class="s">            </span>
+<span class="s">        for name , value in self.p_model2.params.iteritems():</span>
+<span class="s">            # No 2D-supported</span>
+<span class="s">            #if name not in self.p_model2.orientation_params:</span>
+<span class="s">            new_name = &quot;p2_&quot; + name</span>
+<span class="s">            self.params[new_name]= value</span>
+<span class="s">                </span>
+<span class="s">        # Set &quot;scale&quot; as initializing</span>
+<span class="s">        self._set_scale_factor()</span>
+<span class="s">      </span>
+<span class="s">            </span>
+<span class="s">    def _set_details(self):</span>
+<span class="s">        for name ,detail in self.p_model1.details.iteritems():</span>
+<span class="s">            new_name = &quot;p1_&quot; + name</span>
+<span class="s">            #if new_name not in self.orientation_params:</span>
+<span class="s">            self.details[new_name]= detail</span>
+<span class="s">            </span>
+<span class="s">        for name ,detail in self.p_model2.details.iteritems():</span>
+<span class="s">            new_name = &quot;p2_&quot; + name</span>
+<span class="s">            #if new_name not in self.orientation_params:</span>
+<span class="s">            self.details[new_name]= detail</span>
+<span class="s">    </span>
+<span class="s">    def _set_scale_factor(self):</span>
+<span class="s">        pass</span>
+<span class="s">        </span>
+<span class="s">                </span>
+<span class="s">    def setParam(self, name, value):</span>
+<span class="s">        # set param to this (p1, p2) model</span>
+<span class="s">        self._setParamHelper(name, value)</span>
+<span class="s">        </span>
+<span class="s">        ## setParam to p model </span>
+<span class="s">        model_pre = &#39;&#39;</span>
+<span class="s">        new_name = &#39;&#39;</span>
+<span class="s">        name_split = name.split(&#39;_&#39;, 1)</span>
+<span class="s">        if len(name_split) == 2:</span>
+<span class="s">            model_pre = name.split(&#39;_&#39;, 1)[0]</span>
+<span class="s">            new_name = name.split(&#39;_&#39;, 1)[1]</span>
+<span class="s">        if model_pre == &quot;p1&quot;:</span>
+<span class="s">            if new_name in self.p_model1.getParamList():</span>
+<span class="s">                self.p_model1.setParam(new_name, value)</span>
+<span class="s">        elif model_pre == &quot;p2&quot;:</span>
+<span class="s">             if new_name in self.p_model2.getParamList():</span>
+<span class="s">                self.p_model2.setParam(new_name, value)</span>
+<span class="s">        elif name == &#39;scale_factor&#39;:</span>
+<span class="s">            self.params[&#39;scale_factor&#39;] = value</span>
+<span class="s">        else:</span>
+<span class="s">            raise ValueError, &quot;Model does not contain parameter </span><span class="si">%s</span><span class="s">&quot; % name</span>
+<span class="s">            </span>
+<span class="s">    def getParam(self, name):</span>
+<span class="s">        # Look for dispersion parameters</span>
+<span class="s">        toks = name.split(&#39;.&#39;)</span>
+<span class="s">        if len(toks)==2:</span>
+<span class="s">            for item in self.dispersion.keys():</span>
+<span class="s">                # 2D not supported</span>
+<span class="s">                if item.lower()==toks[0].lower():</span>
+<span class="s">                    for par in self.dispersion[item]:</span>
+<span class="s">                        if par.lower() == toks[1].lower():</span>
+<span class="s">                            return self.dispersion[item][par]</span>
+<span class="s">        else:</span>
+<span class="s">            # Look for standard parameter</span>
+<span class="s">            for item in self.params.keys():</span>
+<span class="s">                if item.lower()==name.lower():</span>
+<span class="s">                    return self.params[item]</span>
+<span class="s">        return  </span>
+<span class="s">        #raise ValueError, &quot;Model does not contain parameter </span><span class="si">%s</span><span class="s">&quot; % name</span>
+<span class="s">       </span>
+<span class="s">    def _setParamHelper(self, name, value):</span>
+<span class="s">        # Look for dispersion parameters</span>
+<span class="s">        toks = name.split(&#39;.&#39;)</span>
+<span class="s">        if len(toks)== 2:</span>
+<span class="s">            for item in self.dispersion.keys():</span>
+<span class="s">                if item.lower()== toks[0].lower():</span>
+<span class="s">                    for par in self.dispersion[item]:</span>
+<span class="s">                        if par.lower() == toks[1].lower():</span>
+<span class="s">                            self.dispersion[item][par] = value</span>
+<span class="s">                            return</span>
+<span class="s">        else:</span>
+<span class="s">            # Look for standard parameter</span>
+<span class="s">            for item in self.params.keys():</span>
+<span class="s">                if item.lower()== name.lower():</span>
+<span class="s">                    self.params[item] = value</span>
+<span class="s">                    return</span>
+<span class="s">            </span>
+<span class="s">        raise ValueError, &quot;Model does not contain parameter </span><span class="si">%s</span><span class="s">&quot; % name</span>
+<span class="s">             </span>
+<span class="s">   </span>
+<span class="s">    def _set_fixed_params(self):</span>
+<span class="s">        for item in self.p_model1.fixed:</span>
+<span class="s">            new_item = &quot;p1&quot; + item</span>
+<span class="s">            self.fixed.append(new_item)</span>
+<span class="s">        for item in self.p_model2.fixed:</span>
+<span class="s">            new_item = &quot;p2&quot; + item</span>
+<span class="s">            self.fixed.append(new_item)</span>
+
+<span class="s">        self.fixed.sort()</span>
+<span class="s">                </span>
+<span class="s">                    </span>
+<span class="s">    def run(self, x = 0.0):</span>
+<span class="s">        self._set_scale_factor()</span>
+<span class="s">        return self.params[&#39;scale_factor&#39;] </span><span class="si">%s</span><span class="s"> </span><span class="se">\</span>
+<span class="s">(self.p_model1.run(x) </span><span class="si">%s</span><span class="s"> self.p_model2.run(x))</span>
+<span class="s">    </span>
+<span class="s">    def runXY(self, x = 0.0):</span>
+<span class="s">        self._set_scale_factor()</span>
+<span class="s">        return self.params[&#39;scale_factor&#39;] </span><span class="si">%s</span><span class="s"> </span><span class="se">\</span>
+<span class="s">(self.p_model1.runXY(x) </span><span class="si">%s</span><span class="s"> self.p_model2.runXY(x))</span>
+<span class="s">    </span>
+<span class="s">    ## Now (May27,10) directly uses the model eval function </span>
+<span class="s">    ## instead of the for-loop in Base Component.</span>
+<span class="s">    def evalDistribution(self, x = []):</span>
+<span class="s">        self._set_scale_factor()</span>
+<span class="s">        return self.params[&#39;scale_factor&#39;] </span><span class="si">%s</span><span class="s"> </span><span class="se">\</span>
+<span class="s">(self.p_model1.evalDistribution(x) </span><span class="si">%s</span><span class="s"> </span><span class="se">\</span>
+<span class="s">self.p_model2.evalDistribution(x))</span>
+
+<span class="s">    def set_dispersion(self, parameter, dispersion):</span>
+<span class="s">        value= None</span>
+<span class="s">        new_pre = parameter.split(&quot;_&quot;, 1)[0]</span>
+<span class="s">        new_parameter = parameter.split(&quot;_&quot;, 1)[1]</span>
+<span class="s">        try:</span>
+<span class="s">            if new_pre == &#39;p1&#39; and </span><span class="se">\</span>
+<span class="s">new_parameter in self.p_model1.dispersion.keys():</span>
+<span class="s">                value= self.p_model1.set_dispersion(new_parameter, dispersion)</span>
+<span class="s">            if new_pre == &#39;p2&#39; and </span><span class="se">\</span>
+<span class="s">new_parameter in self.p_model2.dispersion.keys():</span>
+<span class="s">                value= self.p_model2.set_dispersion(new_parameter, dispersion)</span>
+<span class="s">            self._set_dispersion()</span>
+<span class="s">            return value</span>
+<span class="s">        except:</span>
+<span class="s">            raise </span>
+
+<span class="s">    def fill_description(self, p_model1, p_model2):</span>
+<span class="s">        description = &quot;&quot;</span>
+<span class="s">        description += &quot;This model gives the summation or multiplication of&quot;</span>
+<span class="s">        description += &quot;</span><span class="si">%s</span><span class="s"> and </span><span class="si">%s</span><span class="s">. &quot;% ( p_model1.name, p_model2.name )</span>
+<span class="s">        self.description += description</span>
+<span class="s">          </span>
+<span class="s">    def get_fname(self):</span>
+<span class="s">        path = sys._getframe().f_code.co_filename</span>
+<span class="s">        basename  = os.path.basename(path)</span>
+<span class="s">        name, _ = os.path.splitext(basename)</span>
+<span class="s">        return name     </span>
+<span class="s">           </span>
+<span class="s">if __name__ == &quot;__main__&quot;: </span>
+<span class="s">    m1= Model() </span>
+<span class="s">    #m1.setParam(&quot;p1_scale&quot;, 25)  </span>
+<span class="s">    #m1.setParam(&quot;p1_length&quot;, 1000)</span>
+<span class="s">    #m1.setParam(&quot;p2_scale&quot;, 100) </span>
+<span class="s">    #m1.setParam(&quot;p2_rg&quot;, 100) </span>
+<span class="s">    out1 = m1.runXY(0.01)</span>
+
+<span class="s">    m2= Model()</span>
+<span class="s">    #m2.p_model1.setParam(&quot;scale&quot;, 25) </span>
+<span class="s">    #m2.p_model1.setParam(&quot;length&quot;, 1000) </span>
+<span class="s">    #m2.p_model2.setParam(&quot;scale&quot;, 100)</span>
+<span class="s">    #m2.p_model2.setParam(&quot;rg&quot;, 100)</span>
+<span class="s">    out2 = m2.p_model1.runXY(0.01) </span><span class="si">%s</span><span class="s"> m2.p_model2.runXY(0.01)</span><span class="se">\n</span><span class="s"></span>
+<span class="s">    print &quot;My name is </span><span class="si">%s</span><span class="s">.&quot;% m1.name</span>
+<span class="s">    print out1, &quot; = &quot;, out2</span>
+<span class="s">    if out1 == out2:</span>
+<span class="s">        print &quot;===&gt; Simple Test: Passed!&quot;</span>
+<span class="s">    else:</span>
+<span class="s">        print &quot;===&gt; Simple Test: Failed!&quot;</span>
+<span class="s">&quot;&quot;&quot;</span>
+      
+<span class="c">#if __name__ == &quot;__main__&quot;: </span>
+<span class="c">#    app = wx.PySimpleApp()</span>
+<span class="c">#    frame = TextDialog(id=1, model_list=[&quot;SphereModel&quot;, &quot;CylinderModel&quot;])   </span>
+<span class="c">#    frame.Show(True)</span>
+<span class="c">#    app.MainLoop()             </span>
+
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>
+    <span class="kn">from</span> <span class="nn">sas.perspectives.fitting</span> <span class="kn">import</span> <span class="n">models</span>
+    <span class="n">dir_path</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">find_plugins_dir</span><span class="p">()</span>
+    <span class="n">app</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">()</span>
+    <span class="n">window</span> <span class="o">=</span> <span class="n">EditorWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="n">dir_path</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Editor&quot;</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>         
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/pyconsole.html
===================================================================
--- _modules/sas/perspectives/calculator/pyconsole.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/pyconsole.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,412 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.pyconsole &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.pyconsole</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Console Module display Python console</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">wx.lib.dialogs</span>
+<span class="kn">import</span> <span class="nn">wx.py.editor</span> <span class="kn">as</span> <span class="nn">editor</span>
+<span class="kn">import</span> <span class="nn">wx.py.frame</span> <span class="kn">as</span> <span class="nn">frame</span>
+<span class="kn">import</span> <span class="nn">py_compile</span>
+
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">800</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">700</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">830</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">730</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+<span class="n">ID_COMPILE</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span> 
+<span class="n">ID_RUN</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>  
+
+<div class="viewcode-block" id="compile_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.compile_file">[docs]</a><span class="k">def</span> <span class="nf">compile_file</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Compile a python file</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="kn">import</span> <span class="nn">py_compile</span>
+        <span class="n">py_compile</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> <span class="n">doraise</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+    <span class="k">except</span><span class="p">:</span>
+        <span class="nb">type</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">traceback</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_info</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">value</span>
+    <span class="k">return</span> <span class="bp">None</span> 
+</div>
+<div class="viewcode-block" id="PyConsole"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole">[docs]</a><span class="k">class</span> <span class="nc">PyConsole</span><span class="p">(</span><span class="n">editor</span><span class="o">.</span><span class="n">EditorNotebookFrame</span><span class="p">):</span>
+    <span class="c">## Internal nickname for the window, used by the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;Custom Model Editor&quot;</span>
+    <span class="c">## Name to appear on the window title bar</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;Custom Model Editor&quot;</span>
+    <span class="c">## Flag to tell the AUI manager to put this panel in the center pane</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">False</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">panel</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                    <span class="n">title</span><span class="o">=</span><span class="s">&#39;Python Shell/Editor&#39;</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">)):</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">config</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">editor</span><span class="o">.</span><span class="n">EditorNotebookFrame</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> 
+                                        <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">,</span>
+                                        <span class="n">filename</span><span class="o">=</span><span class="n">filename</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">=</span> <span class="n">base</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_add_menu</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">filename</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">dataDir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">dataDir</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_default_save_location</span>
+        <span class="k">else</span><span class="p">:</span>
+             <span class="n">dataDir</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dataDir</span> <span class="o">=</span> <span class="n">dataDir</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        
+        <span class="bp">self</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="bp">self</span><span class="o">.</span><span class="n">OnNewFile</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_NEW</span><span class="p">)</span>
+        <span class="bp">self</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="bp">self</span><span class="o">.</span><span class="n">OnOpenFile</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_OPEN</span><span class="p">)</span>
+        <span class="bp">self</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="bp">self</span><span class="o">.</span><span class="n">OnSaveFile</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_SAVE</span><span class="p">)</span>
+        <span class="bp">self</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="bp">self</span><span class="o">.</span><span class="n">OnSaveAsFile</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_SAVEAS</span><span class="p">)</span>
+        <span class="bp">self</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="bp">self</span><span class="o">.</span><span class="n">OnCompile</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">ID_COMPILE</span><span class="p">)</span>
+        <span class="bp">self</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="bp">self</span><span class="o">.</span><span class="n">OnRun</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">ID_RUN</span><span class="p">)</span>
+        <span class="bp">self</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_UPDATE_UI</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnUpdateCompileMenu</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">ID_COMPILE</span><span class="p">)</span>
+        <span class="bp">self</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_UPDATE_UI</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnUpdateCompileMenu</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">ID_RUN</span><span class="p">)</span>
+        <span class="bp">self</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_CLOSE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">title</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;Python Shell&#39;</span><span class="p">):</span>
+            <span class="c"># Delete menu item (open and new) if not python shell</span>
+            <span class="c">#self.fileMenu.Delete(wx.ID_NEW)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fileMenu</span><span class="o">.</span><span class="n">Delete</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_OPEN</span><span class="p">)</span>
+        
+   
+    <span class="k">def</span> <span class="nf">_add_menu</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Add menu</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compileMenu</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compileMenu</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">ID_COMPILE</span><span class="p">,</span> <span class="s">&#39;Compile&#39;</span><span class="p">,</span>
+                 <span class="s">&#39;Compile the file&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compileMenu</span><span class="o">.</span><span class="n">AppendSeparator</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compileMenu</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">ID_RUN</span><span class="p">,</span> <span class="s">&#39;Run in Shell&#39;</span><span class="p">,</span>
+                 <span class="s">&#39;Run the file in the Python Shell&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">MenuBar</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">compileMenu</span><span class="p">,</span> <span class="s">&#39;&amp;Run&#39;</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="PyConsole.OnHelp"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.OnHelp">[docs]</a>    <span class="k">def</span> <span class="nf">OnHelp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show a help dialog.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">import</span>  <span class="nn">wx.lib.dialogs</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="s">&#39;Help on key bindings&#39;</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">py</span><span class="o">.</span><span class="n">shell</span><span class="o">.</span><span class="n">HELP_TEXT</span>
+        <span class="n">dlg</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">dialogs</span><span class="o">.</span><span class="n">ScrolledMessageDialog</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span>
+                                                   <span class="n">size</span> <span class="o">=</span> <span class="p">((</span><span class="mi">700</span><span class="p">,</span> <span class="mi">540</span><span class="p">)))</span>
+        <span class="n">fnt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Font</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TELETYPE</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NORMAL</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NORMAL</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">GetChildren</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetFont</span><span class="p">(</span><span class="n">fnt</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">GetChildren</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetInsertionPoint</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="PyConsole.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.set_manager">[docs]</a>    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the manager of this window</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="n">manager</span>
+        </div>
+<div class="viewcode-block" id="PyConsole.OnAbout"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.OnAbout">[docs]</a>    <span class="k">def</span> <span class="nf">OnAbout</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On About</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">message</span> <span class="o">=</span> <span class="n">ABOUT</span>
+        <span class="n">dial</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MessageDialog</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">,</span> <span class="s">&#39;About&#39;</span><span class="p">,</span>
+                           <span class="n">wx</span><span class="o">.</span><span class="n">OK</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ICON_INFORMATION</span><span class="p">)</span>  
+        <span class="n">dial</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="PyConsole.OnNewFile"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.OnNewFile">[docs]</a>    <span class="k">def</span> <span class="nf">OnNewFile</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        OnFileOpen  </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">OnFileNew</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="PyConsole.OnOpenFile"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.OnOpenFile">[docs]</a>    <span class="k">def</span> <span class="nf">OnOpenFile</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        OnFileOpen  </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">OnFileOpen</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="PyConsole.OnSaveFile"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.OnSaveFile">[docs]</a>    <span class="k">def</span> <span class="nf">OnSaveFile</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        OnFileSave overwrite   </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">OnFileSave</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="PyConsole.OnSaveAsFile"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.OnSaveAsFile">[docs]</a>    <span class="k">def</span> <span class="nf">OnSaveAsFile</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        OnFileSaveAs overwrite   </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">OnFileSaveAs</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="PyConsole.bufferOpen"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.bufferOpen">[docs]</a>    <span class="k">def</span> <span class="nf">bufferOpen</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Open file in buffer, bypassing editor bufferOpen</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">bufferHasChanged</span><span class="p">():</span>
+            <span class="n">cancel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">bufferSuggestSave</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">cancel</span><span class="p">:</span>
+                <span class="k">return</span> <span class="n">cancel</span>
+        <span class="n">filedir</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span><span class="o">.</span><span class="n">doc</span><span class="o">.</span><span class="n">filedir</span><span class="p">:</span>
+            <span class="n">filedir</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span><span class="o">.</span><span class="n">doc</span><span class="o">.</span><span class="n">filedir</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">filedir</span><span class="p">:</span>
+            <span class="n">filedir</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dataDir</span>
+        <span class="n">result</span> <span class="o">=</span> <span class="n">editor</span><span class="o">.</span><span class="n">openSingle</span><span class="p">(</span><span class="n">directory</span><span class="o">=</span><span class="n">filedir</span><span class="p">,</span>  
+                            <span class="n">wildcard</span><span class="o">=</span><span class="s">&#39;Python Files (*.py)|*.py&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">result</span><span class="o">.</span><span class="n">path</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bufferCreate</span><span class="p">(</span><span class="n">result</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">cancel</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">return</span> <span class="n">cancel</span>
+    </div>
+<div class="viewcode-block" id="PyConsole.bufferSaveAs"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.bufferSaveAs">[docs]</a>    <span class="k">def</span> <span class="nf">bufferSaveAs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Save buffer to a new filename: Bypassing editor bufferSaveAs</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">filedir</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span><span class="o">.</span><span class="n">doc</span><span class="o">.</span><span class="n">filedir</span><span class="p">:</span>
+            <span class="n">filedir</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span><span class="o">.</span><span class="n">doc</span><span class="o">.</span><span class="n">filedir</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">filedir</span><span class="p">:</span>
+            <span class="n">filedir</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dataDir</span>
+        <span class="n">result</span> <span class="o">=</span> <span class="n">editor</span><span class="o">.</span><span class="n">saveSingle</span><span class="p">(</span><span class="n">directory</span><span class="o">=</span><span class="n">filedir</span><span class="p">,</span> 
+                                   <span class="n">filename</span><span class="o">=</span><span class="s">&#39;untitled.py&#39;</span><span class="p">,</span>
+                                   <span class="n">wildcard</span><span class="o">=</span><span class="s">&#39;Python Files (*.py)|*.py&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">result</span><span class="o">.</span><span class="n">path</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span><span class="o">.</span><span class="n">confirmed</span> <span class="o">=</span> <span class="bp">True</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span><span class="o">.</span><span class="n">saveAs</span><span class="p">(</span><span class="n">result</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
+            <span class="n">cancel</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">cancel</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">return</span> <span class="n">cancel</span>
+        </div>
+<div class="viewcode-block" id="PyConsole.OnRun"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.OnRun">[docs]</a>    <span class="k">def</span> <span class="nf">OnRun</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Run</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_changed</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span><span class="o">.</span><span class="n">doc</span><span class="o">.</span><span class="n">filepath</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">editor</span><span class="o">.</span><span class="n">setFocus</span><span class="p">()</span>
+            <span class="c"># Why we have to do this (Otherwise problems on Windows)?</span>
+            <span class="n">forward_path</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span><span class="o">.</span><span class="n">doc</span><span class="o">.</span><span class="n">filepath</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">&#39;</span><span class="p">,</span> <span class="s">&#39;/&#39;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">shell</span><span class="o">.</span><span class="n">Execute</span><span class="p">(</span><span class="s">&quot;execfile(&#39;</span><span class="si">%s</span><span class="s">&#39;)&quot;</span><span class="o">%</span> <span class="n">forward_path</span><span class="p">)</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">shell</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">shell</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">shell</span><span class="o">.</span><span class="n">GetText</span><span class="p">()</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;&gt;&gt;&gt;&quot;</span><span class="p">)[</span><span class="o">-</span><span class="mi">2</span><span class="p">]</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">mssg</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s"> This is not a python file.&quot;</span>
+            <span class="n">title</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+            <span class="n">icon</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ICON_ERROR</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">mssg</span><span class="p">),</span> <span class="n">title</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">icon</span><span class="p">)</span>
+            <span class="k">return</span> <span class="mi">0</span>
+        </div>
+<div class="viewcode-block" id="PyConsole.OnCompile"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.OnCompile">[docs]</a>    <span class="k">def</span> <span class="nf">OnCompile</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Compile</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_changed</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">True</span>
+        <span class="n">run_out</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnRun</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_err_msg</span><span class="p">(</span><span class="n">run_out</span><span class="p">):</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_edit_menu_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">)</span>
+                <span class="c"># Update custom model list in fitpage combobox</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">update_custom_combo</span><span class="p">)</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_check_changed</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>   
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        If content was changed, suggest to save it first</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">bufferHasChanged</span><span class="p">()</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span><span class="o">.</span><span class="n">doc</span><span class="o">.</span><span class="n">filepath</span><span class="p">:</span>
+            <span class="n">cancel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">bufferSuggestSave</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">cancel</span><span class="p">:</span>
+                <span class="k">return</span> <span class="n">cancel</span>
+             
+    <span class="k">def</span> <span class="nf">_get_err_msg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get err_msg</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">mssg</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s"> This is not a python file.&quot;</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+        <span class="n">icon</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ICON_ERROR</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">fname</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">editor</span><span class="o">.</span><span class="n">getStatus</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">fname</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&#39;py&#39;</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">mssg</span><span class="p">),</span> <span class="n">title</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">icon</span><span class="p">)</span>
+                <span class="k">return</span> <span class="bp">False</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="n">compile_file</span><span class="p">(</span><span class="n">fname</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">mssg</span><span class="p">),</span> <span class="n">title</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">icon</span><span class="p">)</span>
+            <span class="k">return</span> <span class="bp">False</span>
+        <span class="n">mssg</span> <span class="o">=</span> <span class="s">&quot;Compiling &#39;</span><span class="si">%s</span><span class="s">&#39;...</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="n">name</span>
+        <span class="k">if</span> <span class="n">msg</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">mssg</span> <span class="o">+=</span> <span class="s">&quot;Error occurred:</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">mssg</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n\n</span><span class="s">&quot;</span>
+            <span class="k">if</span> <span class="n">text</span><span class="p">:</span>
+                <span class="n">mssg</span> <span class="o">+=</span> <span class="s">&quot;Run-Test results:</span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">mssg</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
+                <span class="n">title</span> <span class="o">=</span> <span class="s">&#39;Warning&#39;</span>
+                <span class="n">icon</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ICON_WARNING</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">mssg</span> <span class="o">+=</span> <span class="s">&quot;Successful.</span><span class="se">\n\n</span><span class="s">&quot;</span>
+            <span class="k">if</span> <span class="n">text</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">text</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;Failed&#39;</span><span class="p">)</span> <span class="ow">or</span> <span class="n">text</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;Error:&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="n">mssg</span> <span class="o">+=</span> <span class="s">&quot;But Simple Test FAILED: Please check your code.</span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">mssg</span> <span class="o">+=</span> <span class="s">&quot;Run-Test results:</span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">mssg</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
+            <span class="n">title</span> <span class="o">=</span> <span class="s">&#39;Info&#39;</span>
+            <span class="n">icon</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ICON_INFORMATION</span>
+        <span class="n">dlg</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">dialogs</span><span class="o">.</span><span class="n">ScrolledMessageDialog</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">mssg</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> 
+                                                   <span class="n">size</span> <span class="o">=</span> <span class="p">((</span><span class="mi">550</span><span class="p">,</span> <span class="mi">250</span><span class="p">)))</span>
+        <span class="n">fnt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Font</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TELETYPE</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NORMAL</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NORMAL</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">GetChildren</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetFont</span><span class="p">(</span><span class="n">fnt</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">GetChildren</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetInsertionPoint</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        <span class="k">return</span> <span class="bp">True</span>
+    
+<div class="viewcode-block" id="PyConsole.OnUpdateCompileMenu"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.OnUpdateCompileMenu">[docs]</a>    <span class="k">def</span> <span class="nf">OnUpdateCompileMenu</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Update Compile menu items based on current tap.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">win</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Window</span><span class="o">.</span><span class="n">FindFocus</span><span class="p">()</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">()</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">id</span> <span class="o">==</span> <span class="n">ID_COMPILE</span> <span class="ow">or</span> <span class="nb">id</span> <span class="o">==</span> <span class="n">ID_RUN</span><span class="p">:</span>
+                <span class="n">menu_on</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">buffer</span><span class="o">.</span><span class="n">doc</span><span class="o">.</span><span class="n">filepath</span><span class="p">:</span>
+                    <span class="n">menu_on</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">event</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="n">menu_on</span><span class="p">)</span>
+        <span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span>
+            <span class="c"># This menu option is not supported in the current context.</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="PyConsole.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.pyconsole.PyConsole.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Close event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="o">.</span><span class="n">py_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+                    </div></div>
+<span class="n">ABOUT</span> <span class="o">=</span>  <span class="s">&quot;Welcome to Python </span><span class="si">%s</span><span class="s">! </span><span class="se">\n\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">version</span><span class="o">.</span><span class="n">split</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
+<span class="n">ABOUT</span> <span class="o">+=</span> <span class="s">&quot;This uses Py Shell/Editor in wx (developed by Patrick K. O&#39;Brien).</span><span class="se">\n</span><span class="s">&quot;</span>
+<span class="n">ABOUT</span> <span class="o">+=</span> <span class="s">&quot;If this is your first time using Python, </span><span class="se">\n</span><span class="s">&quot;</span>
+<span class="n">ABOUT</span> <span class="o">+=</span> <span class="s">&quot;you should definitely check out the tutorial &quot;</span>
+<span class="n">ABOUT</span> <span class="o">+=</span> <span class="s">&quot;on the Internet at http://www.python.org/doc/tut/.&quot;</span>
+ 
+        
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>
+   
+    <span class="n">app</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">()</span>
+    <span class="n">dlg</span> <span class="o">=</span> <span class="n">PyConsole</span><span class="p">()</span>
+    <span class="n">dlg</span><span class="o">.</span><span class="n">Show</span><span class="p">()</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/resolcal_thread.html
===================================================================
--- _modules/sas/perspectives/calculator/resolcal_thread.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/resolcal_thread.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,154 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.resolcal_thread &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.resolcal_thread</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Thread for Resolution computation</span>
+<span class="sd">&quot;&quot;&quot;</span> 
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">from</span> <span class="nn">sas.data_util.calcthread</span> <span class="kn">import</span> <span class="n">CalcThread</span>
+
+<div class="viewcode-block" id="CalcRes"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolcal_thread.CalcRes">[docs]</a><span class="k">class</span> <span class="nc">CalcRes</span><span class="p">(</span><span class="n">CalcThread</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Compute Resolution</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
+                 <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span>
+                 <span class="n">func</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">qx</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">qy</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">qx_min</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">qx_max</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">qy_min</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">qy_max</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">image</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">completefn</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">updatefn</span>   <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">elapsed</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
+                 <span class="n">yieldtime</span>  <span class="o">=</span> <span class="mf">0.01</span><span class="p">,</span>
+                 <span class="n">worktime</span>   <span class="o">=</span> <span class="mf">0.01</span>
+                 <span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">CalcThread</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">completefn</span><span class="p">,</span>
+                 <span class="n">updatefn</span><span class="p">,</span>
+                 <span class="n">yieldtime</span><span class="p">,</span>
+                 <span class="n">worktime</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">id</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">func</span> <span class="o">=</span> <span class="n">func</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qx</span> <span class="o">=</span> <span class="n">qx</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qy</span> <span class="o">=</span> <span class="n">qy</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qx_min</span> <span class="o">=</span> <span class="n">qx_min</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qx_max</span> <span class="o">=</span> <span class="n">qx_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qy_min</span> <span class="o">=</span> <span class="n">qy_min</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qy_max</span> <span class="o">=</span> <span class="n">qy_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">image</span> <span class="o">=</span> <span class="n">image</span>
+        
+        
+<div class="viewcode-block" id="CalcRes.compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolcal_thread.CalcRes.compute">[docs]</a>    <span class="k">def</span> <span class="nf">compute</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        excuting computation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">image</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qx</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qy</span><span class="p">,</span> 
+                        <span class="bp">self</span><span class="o">.</span><span class="n">qx_min</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qx_max</span><span class="p">,</span> 
+                        <span class="bp">self</span><span class="o">.</span><span class="n">qy_min</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qy_max</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">elapsed</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">(</span><span class="n">image</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">image</span><span class="p">,</span>
+                      <span class="n">elapsed</span> <span class="o">=</span> <span class="n">elapsed</span><span class="p">)</span>
+        
+        
+        
+        </div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/resolution_calculator_panel.html
===================================================================
--- _modules/sas/perspectives/calculator/resolution_calculator_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/resolution_calculator_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,1521 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.resolution_calculator_panel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.resolution_calculator_panel</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">This software was developed by the University of Tennessee as part of the</span>
+<span class="sd">Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="sd">project funded by the US National Science Foundation. </span>
+
+<span class="sd">See the license text in license.txt</span>
+
+<span class="sd">copyright 2008, 2009, 2010 University of Tennessee</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">matplotlib</span>
+<span class="kn">import</span> <span class="nn">math</span>
+<span class="c">#Use the WxAgg back end. The Wx one takes too long to render</span>
+<span class="n">matplotlib</span><span class="o">.</span><span class="n">use</span><span class="p">(</span><span class="s">&#39;WXAgg&#39;</span><span class="p">)</span>
+<span class="kn">from</span> <span class="nn">matplotlib.backends.backend_wxagg</span> <span class="kn">import</span> <span class="n">FigureCanvasWxAgg</span> <span class="k">as</span> <span class="n">FigureCanvas</span>
+<span class="kn">from</span> <span class="nn">matplotlib.backends.backend_wxagg</span> <span class="kn">import</span> <span class="n">NavigationToolbar2Wx</span> <span class="k">as</span> <span class="n">Toolbar</span>
+<span class="kn">from</span> <span class="nn">matplotlib.backend_bases</span> <span class="kn">import</span> <span class="n">FigureManagerBase</span>
+<span class="c"># Wx-Pylab magic for displaying plots within an application&#39;s window.</span>
+<span class="kn">from</span> <span class="nn">matplotlib</span> <span class="kn">import</span> <span class="n">_pylab_helpers</span>
+<span class="c"># The Figure object is used to create backend-independent plot representations.</span>
+<span class="kn">from</span> <span class="nn">matplotlib.figure</span> <span class="kn">import</span> <span class="n">Figure</span>
+
+<span class="c">#from sas.guicomm.events import StatusEvent  </span>
+<span class="kn">from</span> <span class="nn">sas.calculator.resolution_calculator</span> <span class="kn">import</span> <span class="n">ResolutionCalculator</span> 
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>  
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.calculator_widgets</span> <span class="kn">import</span> <span class="n">OutputTextCtrl</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.calculator_widgets</span> <span class="kn">import</span> <span class="n">InputTextCtrl</span>
+<span class="kn">from</span> <span class="nn">wx.lib.scrolledpanel</span> <span class="kn">import</span> <span class="n">ScrolledPanel</span>
+<span class="kn">from</span> <span class="nn">math</span> <span class="kn">import</span> <span class="n">fabs</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator</span> <span class="kn">import</span> <span class="n">calculator_widgets</span> <span class="k">as</span> <span class="n">widget</span>   
+
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">100</span>
+<span class="n">_Q_DEFAULT</span> <span class="o">=</span> <span class="mf">0.0</span>
+<span class="c">#Slit length panel size </span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">525</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">653</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+    <span class="n">IS_WIN</span> <span class="o">=</span> <span class="bp">True</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">540</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">662</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    <span class="n">IS_WIN</span> <span class="o">=</span> <span class="bp">False</span>
+
+<span class="n">_SOURCE_MASS</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;Alpha&#39;</span><span class="p">:</span><span class="mf">6.64465620E-24</span><span class="p">,</span>
+                <span class="s">&#39;Deuteron&#39;</span><span class="p">:</span><span class="mf">3.34358320E-24</span><span class="p">,</span>
+                <span class="s">&#39;Neutron&#39;</span><span class="p">:</span><span class="mf">1.67492729E-24</span><span class="p">,</span> 
+                <span class="s">&#39;Photon&#39;</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
+                <span class="s">&#39;Proton&#39;</span><span class="p">:</span><span class="mf">1.67262137E-24</span><span class="p">,</span>
+                <span class="s">&#39;Triton&#39;</span><span class="p">:</span><span class="mf">5.00826667E-24</span><span class="p">}</span>
+
+<div class="viewcode-block" id="ResolutionCalculatorPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolution_calculator_panel.ResolutionCalculatorPanel">[docs]</a><span class="k">class</span> <span class="nc">ResolutionCalculatorPanel</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Provides the Resolution calculator GUI.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal nickname for the window, used by the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;SAS Resolution Estimator&quot;</span>
+    <span class="c">## Name to appear on the window title bar</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+    <span class="c">## Flag to tell the AUI manager to put this panel in the center pane</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">True</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span>  <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;size&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">PANEL_WIDTH</span> <span class="o">*</span> <span class="mi">2</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">)</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;style&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">FULL_REPAINT_ON_RESIZE</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        
+        <span class="c"># input defaults</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qx</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qy</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># dQ defaults</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_r</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_phi</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_1d</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># monchromatic or polychromatic</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wave_color</span> <span class="o">=</span> <span class="s">&#39;mono&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">num_wave</span> <span class="o">=</span> <span class="mi">10</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_dic</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c"># dQ 2d image</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">image</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># results of sigmas</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_strings</span> <span class="o">=</span> <span class="s">&#39; &#39;</span>
+        <span class="c">#Font size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="c"># Object that receive status event</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span> <span class="o">=</span> <span class="n">ResolutionCalculator</span><span class="p">()</span>
+        <span class="c"># Source selection dic</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_mass</span> <span class="o">=</span> <span class="n">_SOURCE_MASS</span>
+        <span class="c">#layout attribute</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># detector coordinate of estimation of sigmas</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">det_coordinate</span> <span class="o">=</span> <span class="s">&#39;cartesian&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_cb</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Define the main sizers building to build this application.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vertical_l_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_spacer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_frame</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_frame</span><span class="p">,</span>
+                                                  <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_source</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">window_caption</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_source</span><span class="p">,</span>
+                                                    <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mass_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">intensity_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_aperture_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_aperture_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source2sample_distance_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2sample_distance_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2detector_distance_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_size_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_pix_size_sizer</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>
+        <span class="c">#self.detector_offset_sizer = wx.BoxSizer(wx.HORIZONTAL)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">input_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+        
+    <span class="k">def</span> <span class="nf">_layout_mass</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing mass</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the mass</span>
+        <span class="n">mass_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">mass</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mass_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Source: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mass_hint</span> <span class="o">=</span> <span class="s">&quot;Mass of Neutrons m = </span><span class="si">%s</span><span class="s"> [g]&quot;</span>\
+                                 <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">mass</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_cb</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+                                <span class="n">name</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%s</span><span class="s">&#39;</span><span class="o">%</span><span class="n">mass_value</span><span class="p">)</span>
+        <span class="c"># Sort source name because wx2.9 on Mac does not support CB_SORT</span>
+        <span class="c"># Custom sorting</span>
+        <span class="n">source_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">source_mass</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">name_source</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
+            <span class="n">source_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">name_source</span><span class="p">)</span>
+        <span class="n">source_list</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">idx</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">source_list</span><span class="p">)):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">source_cb</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">source_list</span><span class="p">[</span><span class="n">idx</span><span class="p">],</span> <span class="n">idx</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_cb</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="s">&quot;Neutron&quot;</span><span class="p">)</span> 
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">source_cb</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_source_selection</span><span class="p">)</span> 
+        
+        <span class="c"># combo box for color</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wave_color_cb</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+                                <span class="n">name</span> <span class="o">=</span> <span class="s">&#39;color&#39;</span><span class="p">)</span>
+        <span class="c"># two choices</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wave_color_cb</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;Monochromatic&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wave_color_cb</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;TOF&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wave_color_cb</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="s">&quot;Monochromatic&quot;</span><span class="p">)</span> 
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wave_color_cb</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_source_color</span><span class="p">)</span> 
+        
+        <span class="n">source_hint</span> <span class="o">=</span> <span class="s">&quot;Source Selection: Affect on&quot;</span>
+        <span class="n">source_hint</span> <span class="o">+=</span> <span class="s">&quot; the gravitational contribution.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">source_hint</span> <span class="o">+=</span> <span class="s">&quot;Mass of </span><span class="si">%s</span><span class="s">: m = </span><span class="si">%s</span><span class="s"> [g]&quot;</span> <span class="o">%</span> \
+                            <span class="p">(</span><span class="s">&#39;Neutron&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">mass</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mass_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">source_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mass_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">mass_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">source_cb</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wave_color_cb</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)])</span>   
+        
+    <span class="k">def</span> <span class="nf">_layout_intensity</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing intensity</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the intensity</span>
+        <span class="n">intensity_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">intensity</span><span class="p">)</span>
+        <span class="n">intensity_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[counts/s]&#39;</span><span class="p">)</span>
+        <span class="n">intensity_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Intensity: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">intensity_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                        <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">intensity_hint</span> <span class="o">=</span> <span class="s">&quot;Intensity of Neutrons&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">intensity_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">intensity_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">intensity_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">intensity_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">intensity_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">intensity_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">intensity_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">intensity_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>   
+
+        
+    <span class="k">def</span> <span class="nf">_layout_wavelength</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing wavelength</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the wavelength</span>
+        <span class="n">wavelength_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">get_wavelength</span><span class="p">())</span>
+        <span class="n">wavelength_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[A]&#39;</span><span class="p">)</span>
+        <span class="n">wavelength_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Wavelength: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">wavelength_hint</span> <span class="o">=</span> <span class="s">&quot;Wavelength of Neutrons&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">wavelength_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">wavelength_hint</span><span class="p">)</span>
+
+        <span class="c"># get the spectrum</span>
+        <span class="n">spectrum_value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">get_default_spectrum</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_dic</span><span class="p">[</span><span class="s">&#39;Add new&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_dic</span><span class="p">[</span><span class="s">&#39;Flat&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">spectrum_value</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Spectrum: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+                                <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span>
+                                <span class="n">name</span> <span class="o">=</span> <span class="s">&#39;spectrum&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;Add new&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="s">&#39;Flat&#39;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_spectrum_cb</span><span class="p">)</span> 
+        <span class="n">spectrum_hint</span> <span class="o">=</span> <span class="s">&quot;Wavelength Spectrum: Intensity vs. wavelength&quot;</span>
+        <span class="c">#self.spectrum_cb.SetValue(spectrum_value)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="s">&#39;Flat&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">spectrum_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">wavelength_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">wavelength_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">spectrum_txt</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>   
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_txt</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_wavelength_spread</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing wavelength</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the wavelength</span>
+        <span class="n">wavelength_spread_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">get_wavelength_spread</span><span class="p">())</span>
+        <span class="n">wavelength_spread_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="n">wavelength_spread_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Wavelength Spread: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">wavelength_spread_hint</span> <span class="o">=</span> <span class="s">&quot;Wavelength  Spread of Neutrons&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">wavelength_spread_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">wavelength_spread_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">wavelength_spread_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                <span class="p">(</span><span class="n">wavelength_spread_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>      
+         
+        
+    <span class="k">def</span> <span class="nf">_layout_source_aperture</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing source aperture size</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the wavelength</span>
+        <span class="n">source_aperture_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">source_aperture_size</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">source_aperture_size</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">source_aperture_value</span> <span class="o">+=</span> <span class="s">&quot;, &quot;</span>
+            <span class="n">source_aperture_value</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span>\
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">source_aperture_size</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="n">source_aperture_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[cm]&#39;</span><span class="p">)</span>
+        <span class="n">source_aperture_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Source Aperture Size: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_aperture_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">source_aperture_hint</span> <span class="o">=</span> <span class="s">&quot;Source Aperture Size&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_aperture_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">source_aperture_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_aperture_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">source_aperture_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_aperture_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">source_aperture_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">source_aperture_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                <span class="p">(</span><span class="n">source_aperture_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>  
+
+        
+    <span class="k">def</span> <span class="nf">_layout_sample_aperture</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing sample aperture size</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the wavelength</span>
+        <span class="n">sample_aperture_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sample_aperture_size</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sample_aperture_size</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">sample_aperture_value</span> <span class="o">+=</span> <span class="s">&quot;, &quot;</span>
+            <span class="n">sample_aperture_value</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span>\
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sample_aperture_size</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="n">sample_aperture_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[cm]&#39;</span><span class="p">)</span>
+        <span class="n">sample_aperture_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Sample Aperture Size: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_aperture_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">sample_aperture_hint</span> <span class="o">=</span> <span class="s">&quot;Sample Aperture Size&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_aperture_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">sample_aperture_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_aperture_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">sample_aperture_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_aperture_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">sample_aperture_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sample_aperture_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                <span class="p">(</span><span class="n">sample_aperture_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>  
+
+
+    <span class="k">def</span> <span class="nf">_layout_source2sample_distance</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing souce2sample_distance</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the wavelength</span>
+        <span class="n">source2sample_distance_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span>\
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">source2sample_distance</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+        <span class="n">source2sample_distance_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[cm]&#39;</span><span class="p">)</span>
+        <span class="n">source2sample_distance_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Source to Sample Aperture Distance: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source2sample_distance_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">source2sample_distance_hint</span> <span class="o">=</span> <span class="s">&quot;Source to Sample Aperture Distance&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source2sample_distance_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">source2sample_distance_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source2sample_distance_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+                                                <span class="n">source2sample_distance_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source2sample_distance_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">source2sample_distance_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">source2sample_distance_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                            <span class="p">(</span><span class="n">source2sample_distance_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>  
+
+    <span class="k">def</span> <span class="nf">_layout_sample2sample_distance</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing sampleslit2sample_distance</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the distance</span>
+        <span class="n">sample2sample_distance_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span>\
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sample2sample_distance</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+        <span class="n">sample2sample_distance_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[cm]&#39;</span><span class="p">)</span>
+        <span class="n">sample2sample_distance_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Sample Offset: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2sample_distance_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">sample2sample_distance_hint</span> <span class="o">=</span> <span class="s">&quot;Sample Aperture to Sample Distance&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2sample_distance_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">sample2sample_distance_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2sample_distance_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+                                                <span class="n">sample2sample_distance_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2sample_distance_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">sample2sample_distance_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sample2sample_distance_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                            <span class="p">(</span><span class="n">sample2sample_distance_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>  
+
+
+
+    <span class="k">def</span> <span class="nf">_layout_sample2detector_distance</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing sample2detector_distance</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the wavelength</span>
+        <span class="n">sample2detector_distance_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span>\
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sample2detector_distance</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+
+        <span class="n">sample2detector_distance_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[cm]&#39;</span><span class="p">)</span>
+        <span class="n">sample2detector_distance_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Sample Aperture to Detector Distance: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2detector_distance_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">sample2detector_distance_hint</span> <span class="o">=</span> \
+                                <span class="s">&quot;Sample Aperture to Detector Distance&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2detector_distance_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span>\
+                                                <span class="n">sample2detector_distance_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2detector_distance_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+                                                <span class="n">sample2detector_distance_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2detector_distance_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([</span>\
+                        <span class="p">(</span><span class="n">sample2detector_distance_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>        
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sample2detector_distance_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                        <span class="p">(</span><span class="n">sample2detector_distance_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>  
+        
+    <span class="k">def</span> <span class="nf">_layout_detector_size</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing detector size</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the wavelength</span>
+        <span class="n">detector_size_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_size</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_size</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">detector_size_value</span> <span class="o">+=</span> <span class="s">&quot;, &quot;</span>
+            <span class="n">detector_size_value</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_size</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="n">detector_size_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="n">detector_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Number of Pixels on Detector: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_size_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">detector_size_hint</span> <span class="o">=</span> <span class="s">&quot;Number of Pixels on Detector&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">detector_size_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_size_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">detector_size_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_size_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">detector_size_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">detector_size_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">detector_size_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>  
+
+        
+    <span class="k">def</span> <span class="nf">_layout_detector_pix_size</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing detector pixel size</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the detector_pix_size</span>
+        <span class="n">detector_pix_size_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_pix_size</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_pix_size</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">detector_pix_size_value</span> <span class="o">+=</span> <span class="s">&quot;, &quot;</span>
+            <span class="n">detector_pix_size_value</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_pix_size</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="n">detector_pix_size_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[cm]&#39;</span><span class="p">)</span>
+        <span class="n">detector_pix_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Detector Pixel Size: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_pix_size_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">detector_pix_size_hint</span> <span class="o">=</span> <span class="s">&quot;Detector Pixel Size&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_pix_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">detector_pix_size_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_pix_size_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">detector_pix_size_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_pix_size_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">detector_pix_size_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">detector_pix_size_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                <span class="p">(</span><span class="n">detector_pix_size_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_input</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing inputs; qx, qy</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        
+        <span class="n">q_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                            <span class="s">&quot;[Q Location of the Estimation]:&quot;</span><span class="p">)</span>
+        <span class="c"># sizers for inputs</span>
+        <span class="n">inputQx_sizer</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>
+        <span class="n">inputQy_sizer</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>
+        <span class="c"># get the default dq</span>
+        <span class="n">qx_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">_Q_DEFAULT</span><span class="p">)</span>
+        <span class="n">qy_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">_Q_DEFAULT</span><span class="p">)</span>
+        <span class="n">qx_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[1/A]  &#39;</span><span class="p">)</span>
+        <span class="n">qy_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[1/A]  &#39;</span><span class="p">)</span>
+        <span class="n">qx_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Qx: &#39;</span><span class="p">)</span>
+        <span class="n">qy_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;Qy: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qx_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">3</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qy_tcl</span> <span class="o">=</span> <span class="n">InputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">3</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">qx_hint</span> <span class="o">=</span> <span class="s">&quot;Type the Qx value.&quot;</span>
+        <span class="n">qy_hint</span> <span class="o">=</span> <span class="s">&quot;Type the Qy value.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qx_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">qx_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qy_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">qy_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qx_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">qx_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qy_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">qy_hint</span><span class="p">)</span>
+        <span class="n">inputQx_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">qx_name_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qx_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">qx_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)])</span>
+        <span class="n">inputQy_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">qy_name_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qy_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">qy_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">input_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">q_title</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span> 
+                                    <span class="p">(</span><span class="n">inputQx_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">inputQy_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+                                <span class="c">#(self.compute_button, 0, wx.LEFT, 30)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_output</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing dQ|| and dQ+</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">sigma_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                        <span class="s">&quot;[Standard Deviation of the Resolution Distribution]:&quot;</span><span class="p">)</span>
+         <span class="c"># sizers for inputs</span>
+        <span class="n">outputQxy_sizer</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>
+        <span class="n">outputQ_sizer</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>
+        <span class="n">sigma_unit</span> <span class="o">=</span> <span class="s">&#39;[&#39;</span><span class="o">+</span><span class="s">&#39;1/A&#39;</span> <span class="o">+</span><span class="s">&#39;]&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_r_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                           <span class="s">&#39;Sigma_x:   &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_r_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mf">0.8</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_phi_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                           <span class="s">&#39;Sigma_y:&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_phi_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mf">0.8</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_lamd_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                           <span class="s">&#39;Sigma_lamd:&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_lamd_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mf">0.7</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">sigma_1d_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;( 1D:   Sigma:&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_1d_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mf">0.7</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">sigmax_hint</span> <span class="o">=</span> <span class="s">&quot; The x component of the geometric resolution,&quot;</span>
+        <span class="n">sigmax_hint</span> <span class="o">+=</span>  <span class="s">&quot; excluding sigma_lamda.&quot;</span>
+        <span class="n">sigmay_hint</span> <span class="o">=</span> <span class="s">&quot; The y component of the geometric resolution,&quot;</span>
+        <span class="n">sigmay_hint</span> <span class="o">+=</span>  <span class="s">&quot; excluding sigma_lamda.&quot;</span>
+        <span class="n">sigma_hint_lamd</span> <span class="o">=</span> <span class="s">&quot; The wavelength contribution in the radial direction&quot;</span>
+        <span class="n">sigma_hint_lamd</span> <span class="o">+=</span> <span class="s">&quot;.</span><span class="se">\n</span><span class="s"> Note: The phi component is always zero.&quot;</span>
+        <span class="n">sigma_hint_1d</span> <span class="o">=</span> <span class="s">&quot; Resolution in 1-dimension (for 1D data).&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_r_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">sigmax_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_phi_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">sigmay_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_lamd_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">sigma_hint_lamd</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_1d_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">sigma_hint_1d</span><span class="p">)</span>
+        <span class="n">sigma_r_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">sigma_unit</span><span class="p">)</span>
+        <span class="n">sigma_phi_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">sigma_unit</span><span class="p">)</span>
+        <span class="n">sigma_lamd_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">sigma_unit</span><span class="p">)</span>
+        <span class="n">sigma_1d_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">sigma_unit</span><span class="o">+</span><span class="s">&#39; )&#39;</span><span class="p">)</span>
+        <span class="n">outputQxy_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">sigma_r_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sigma_r_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">sigma_r_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sigma_phi_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sigma_phi_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">sigma_phi_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)])</span>
+        <span class="n">outputQ_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">sigma_lamd_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sigma_lamd_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">sigma_lamd_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">sigma_1d_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sigma_1d_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">sigma_1d_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">sigma_title</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span> 
+                                    <span class="p">(</span><span class="n">outputQxy_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">outputQ_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        
+    
+    <span class="k">def</span> <span class="nf">_layout_hint</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing hint </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="c">#hint_msg += &quot;This tool is to approximately compute &quot;</span>
+        <span class="c">#hint_msg += &quot;the instrumental resolution (dQ).&quot;</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">hint_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)])</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="c"># coordinate selction removed</span>
+        <span class="c">#outerbox_txt = wx.StaticText(self, -1, &#39;Outer Box&#39;)</span>
+        <span class="c">#self.x_y_rb = wx.RadioButton(self, -1,&quot;Cartesian&quot;)</span>
+        <span class="c">#self.Bind(wx.EVT_RADIOBUTTON,</span>
+        <span class="c">#          self._on_xy_coordinate, id=self.x_y_rb.GetId())</span>
+        <span class="c">#self.r_phi_rb = wx.RadioButton(self, -1,&quot;Polar&quot;)</span>
+        <span class="c">#self.Bind(wx.EVT_RADIOBUTTON,</span>
+        <span class="c">#          self._on_rp_coordinate, id=self.r_phi_rb.GetId())</span>
+        <span class="c">#self.r_phi_rb.SetValue(True)</span>
+        <span class="c">#reset button</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Reset&quot;</span><span class="p">)</span>
+        <span class="n">hint_on_reset</span> <span class="o">=</span> <span class="s">&quot;...&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_button</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_on_reset</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_reset</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="c">#compute button</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Compute&quot;</span><span class="p">)</span>
+        <span class="n">hint_on_compute</span> <span class="o">=</span> <span class="s">&quot;Compute... Please wait until finished.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_button</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_on_compute</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_compute</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="c"># close button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span><span class="s">&#39;Close&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close this window.&quot;</span><span class="p">)</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        self.button_sizer.AddMany([(self.r_phi_rb,  0, wx.LEFT, 15),</span>
+<span class="sd">                                   (self.x_y_rb,  0, wx.LEFT, 15),</span>
+<span class="sd">                                   (self.reset_button, 0, wx.LEFT, 50),</span>
+<span class="sd">                                   (self.compute_button, 0, wx.LEFT, 15),</span>
+<span class="sd">                                   (self.bt_close, 0, wx.LEFT, 15)])#370)])</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">110</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">reset_button</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">LEFT</span><span class="p">,</span> <span class="mi">50</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">compute_button</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_button</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_image</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Layout for image plot</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">color</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">SystemSettings</span><span class="o">.</span><span class="n">GetColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">SYS_COLOUR_BACKGROUND</span><span class="p">)</span>
+
+        <span class="c"># Contribution by James C.</span>
+        <span class="c"># Instantiate a figure object that will contain our plots.</span>
+        <span class="c"># Make the fig a little smaller than the default</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">figure</span> <span class="o">=</span> <span class="n">Figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mf">6.5</span><span class="p">,</span> <span class="mi">6</span><span class="p">),</span> <span class="n">facecolor</span> <span class="o">=</span> <span class="s">&#39;white&#39;</span><span class="p">)</span>
+        
+        <span class="c"># Initialize the figure canvas, mapping the figure object to the plot</span>
+        <span class="c"># engine backend.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">canvas</span> <span class="o">=</span> <span class="n">FigureCanvas</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_ANY</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="p">)</span>
+
+        <span class="c"># Wx-Pylab magic ...</span>
+        <span class="c"># Make our canvas the active figure manager for pylab so that when</span>
+        <span class="c"># pylab plotting statements are executed they will operate on our</span>
+        <span class="c"># canvas and not create a new frame and canvas for display purposes.</span>
+        <span class="c"># This technique allows this application to execute code that uses</span>
+        <span class="c"># pylab stataments to generate plots and embed these plots in our</span>
+        <span class="c"># application window(s).</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fm</span> <span class="o">=</span> <span class="n">FigureManagerBase</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">canvas</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+        <span class="n">_pylab_helpers</span><span class="o">.</span><span class="n">Gcf</span><span class="o">.</span><span class="n">set_active</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fm</span><span class="p">)</span>
+        
+        <span class="c"># Instantiate the matplotlib navigation toolbar and explicitly show it.</span>
+        <span class="n">mpl_toolbar</span> <span class="o">=</span> <span class="n">Toolbar</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">canvas</span><span class="p">)</span>
+        <span class="c"># Diable pan</span>
+        <span class="n">mpl_toolbar</span><span class="o">.</span><span class="n">DeleteToolByPos</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
+
+        <span class="c"># Add a toolbar into the frame</span>
+        <span class="n">mpl_toolbar</span><span class="o">.</span><span class="n">Realize</span><span class="p">()</span>
+
+        <span class="c"># Compute before adding the canvas to the sizer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_compute</span><span class="p">()</span>
+        
+        <span class="c"># Fill up the sizer</span>
+        <span class="k">if</span> <span class="n">IS_WIN</span><span class="p">:</span>
+            <span class="n">gap</span> <span class="o">=</span> <span class="mi">27</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">gap</span> <span class="o">=</span> <span class="mi">13</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">canvas</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_spacer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="n">gap</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_spacer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_sizer</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_spacer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="n">gap</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_spacer</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">StaticLine</span><span class="p">(</span><span class="bp">self</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_spacer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">mpl_toolbar</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
+
+        
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Draw window layout</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#  Title of parameters</span>
+        <span class="n">instrument_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                <span class="s">&#39;[Instrumental Parameters]:&#39;</span><span class="p">)</span>
+        <span class="c"># Build individual layouts</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_mass</span><span class="p">()</span>
+        <span class="c">#self._layout_intensity()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_wavelength</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_wavelength_spread</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_source_aperture</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_sample_aperture</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_source2sample_distance</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_sample2detector_distance</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_sample2sample_distance</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_detector_size</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_detector_pix_size</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_input</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_output</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_hint</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="c"># Fill the sizers</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">instrument_txt</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mass_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="c">#(self.intensity_sizer, 0,</span>
+                                      <span class="c">#wx.EXPAND|wx.TOP|wx.BOTTOM, 5),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">source_aperture_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sample_aperture_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">source2sample_distance_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sample2detector_distance_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sample2sample_distance_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">detector_size_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">detector_pix_size_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">input_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vertical_l_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vertical_l_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+        <span class="c"># Build image plot layout                     </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_image</span><span class="p">()</span>
+        <span class="c"># Add a vertical static line</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> 
+                            <span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="n">PANEL_HEIGHT</span> <span class="o">*</span> <span class="mf">0.94</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">LI_VERTICAL</span><span class="p">))</span>
+        <span class="c"># Add the plot to main sizer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vertical_r_spacer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+
+<div class="viewcode-block" id="ResolutionCalculatorPanel.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolution_calculator_panel.ResolutionCalculatorPanel.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        close the window containing this panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get ready for other events</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="c"># Clear the plot</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">image</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">image</span><span class="o">.</span><span class="n">clf</span><span class="p">()</span>
+            <span class="c"># reset image</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">image</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># Close panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">OnClose</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        
+    </div>
+<div class="viewcode-block" id="ResolutionCalculatorPanel.on_compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolution_calculator_panel.ResolutionCalculatorPanel.on_compute">[docs]</a>    <span class="k">def</span> <span class="nf">on_compute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span> <span class="o">=</span> <span class="bp">None</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Execute the computation of resolution</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">on_compute_call</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="ResolutionCalculatorPanel.on_compute_call"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolution_calculator_panel.ResolutionCalculatorPanel.on_compute_call">[docs]</a>    <span class="k">def</span> <span class="nf">on_compute_call</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Execute the computation of resolution</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Skip event for next event</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please Check your input values &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;before starting the computation...&quot;</span>
+
+        <span class="c"># message</span>
+        <span class="n">status_type</span> <span class="o">=</span> <span class="s">&#39;progress&#39;</span> 
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;Calculating...&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">status_type</span><span class="p">)</span>
+
+        <span class="n">status_type</span> <span class="o">=</span> <span class="s">&#39;stop&#39;</span>           
+        <span class="c"># Q min max list default</span>
+        <span class="n">qx_min</span> <span class="o">=</span> <span class="p">[]</span>   
+        <span class="n">qx_max</span> <span class="o">=</span> <span class="p">[]</span> 
+        <span class="n">qy_min</span> <span class="o">=</span> <span class="p">[]</span> 
+        <span class="n">qy_max</span> <span class="o">=</span> <span class="p">[]</span> 
+        <span class="c"># possible max qrange</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qxmin_limit</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qxmax_limit</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qymin_limit</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qymax_limit</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c"># q min and max of the detector</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># Get all the values at set to compute</span>
+            <span class="c"># default num bin of wave list</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">num_wave</span> <span class="o">=</span> <span class="mi">10</span>
+            <span class="n">wavelength</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_str2longlist</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="n">source</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">source_cb</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">mass</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">source_mass</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="p">)]</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_neutron_mass</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">mass</span><span class="p">))</span>
+            <span class="n">wavelength_spread</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_str2longlist</span><span class="p">(</span>\
+                        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;;&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="c"># Validate the wave inputs</span>
+            <span class="n">wave_input</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_q_input</span><span class="p">(</span><span class="n">wavelength</span><span class="p">,</span> <span class="n">wavelength_spread</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">wave_input</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wavelength</span><span class="p">,</span> <span class="n">wavelength_spread</span> <span class="o">=</span> <span class="n">wave_input</span>
+    
+            <span class="c">#self.resolution.set_wave(float(wavelength))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_wave</span><span class="p">(</span><span class="n">wavelength</span><span class="p">)</span>
+            <span class="c">#self.resolution.set_wave_spread(float(wavelength_spread))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_wave_spread</span><span class="p">(</span><span class="n">wavelength_spread</span><span class="p">)</span>
+            <span class="n">source_aperture_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">source_aperture_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">source_aperture_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_string2list</span><span class="p">(</span><span class="n">source_aperture_size</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_source_aperture_size</span><span class="p">(</span><span class="n">source_aperture_size</span><span class="p">)</span>
+            <span class="n">sample_aperture_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sample_aperture_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">sample_aperture_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_string2list</span><span class="p">(</span><span class="n">sample_aperture_size</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_sample_aperture_size</span><span class="p">(</span><span class="n">sample_aperture_size</span><span class="p">)</span>
+            <span class="n">source2sample_distance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">source2sample_distance_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">source2sample_distance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_string2list</span><span class="p">(</span><span class="n">source2sample_distance</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_source2sample_distance</span><span class="p">(</span><span class="n">source2sample_distance</span><span class="p">)</span>
+            <span class="n">sample2sample_distance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sample2sample_distance_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">sample2sample_distance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_string2list</span><span class="p">(</span><span class="n">sample2sample_distance</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_sample2sample_distance</span><span class="p">(</span><span class="n">sample2sample_distance</span><span class="p">)</span>
+            <span class="n">sample2detector_distance</span> <span class="o">=</span> \
+                                <span class="bp">self</span><span class="o">.</span><span class="n">sample2detector_distance_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">sample2detector_distance</span> <span class="o">=</span> \
+                                <span class="bp">self</span><span class="o">.</span><span class="n">_string2list</span><span class="p">(</span><span class="n">sample2detector_distance</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_sample2detector_distance</span><span class="p">(</span>\
+                                                    <span class="n">sample2detector_distance</span><span class="p">)</span>
+            <span class="n">detector_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_size_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">detector_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_string2list</span><span class="p">(</span><span class="n">detector_size</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_detector_size</span><span class="p">(</span><span class="n">detector_size</span><span class="p">)</span>
+            <span class="n">detector_pix_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">detector_pix_size_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">detector_pix_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_string2list</span><span class="p">(</span><span class="n">detector_pix_size</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_detector_pix_size</span><span class="p">(</span><span class="n">detector_pix_size</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qx</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_string2inputlist</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qx_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qy</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_string2inputlist</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qy_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            
+            
+            <span class="c"># Find min max of qs</span>
+            <span class="n">xmin</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qx</span><span class="p">)</span>
+            <span class="n">xmax</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qx</span><span class="p">)</span>
+            <span class="n">ymin</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qy</span><span class="p">)</span>
+            <span class="n">ymax</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qy</span><span class="p">)</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_q_input</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qx</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qy</span><span class="p">):</span>
+                <span class="k">raise</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;An error occured during the resolution computation.&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Please check your inputs...&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">status_type</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Warning&#39;</span><span class="p">)</span>
+            <span class="k">return</span>
+            <span class="c">#raise ValueError, &quot;Invalid Q Input...&quot;</span>
+
+        <span class="c"># Validate the q inputs</span>
+        <span class="n">q_input</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_q_input</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qx</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qy</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">q_input</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qx</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qy</span> <span class="o">=</span> <span class="n">q_input</span>
+        
+        <span class="c"># Make list of q min max for mapping</span>
+        <span class="k">for</span> <span class="n">length</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qx</span><span class="p">)):</span>
+            <span class="n">qx_min</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">xmin</span><span class="p">)</span>
+            <span class="n">qx_max</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">xmax</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">length</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qy</span><span class="p">)):</span>
+            <span class="n">qy_min</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ymin</span><span class="p">)</span>
+            <span class="n">qy_max</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ymax</span><span class="p">)</span>
+        
+        <span class="c"># Compute the resolution</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">image</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c">#_pylab_helpers.Gcf.set_active(self.fm)</span>
+            <span class="n">_pylab_helpers</span><span class="o">.</span><span class="n">Gcf</span><span class="o">.</span><span class="n">figs</span> <span class="o">=</span> <span class="p">{}</span>
+            <span class="c"># Clear the image before redraw</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">image</span><span class="o">.</span><span class="n">clf</span><span class="p">()</span>
+            <span class="c"># reset the image</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">reset_image</span><span class="p">()</span>
+
+        <span class="c"># Compute and get the image plot</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="kn">from</span> <span class="nn">sas.perspectives.calculator.resolcal_thread</span> \
+                                                <span class="kn">import</span> <span class="n">CalcRes</span> <span class="k">as</span> <span class="n">thread</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sigma_strings</span> <span class="o">=</span> <span class="s">&#39;</span><span class="se">\n</span><span class="s">Resolution: Computation is finished. </span><span class="se">\n</span><span class="s">&#39;</span>
+            <span class="n">cal_res</span> <span class="o">=</span> <span class="n">thread</span><span class="p">(</span><span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_map_func</span><span class="p">,</span>
+                         <span class="n">qx</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qx</span><span class="p">,</span>
+                         <span class="n">qy</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qy</span><span class="p">,</span>
+                         <span class="n">qx_min</span> <span class="o">=</span> <span class="n">qx_min</span><span class="p">,</span>
+                         <span class="n">qx_max</span> <span class="o">=</span> <span class="n">qx_max</span><span class="p">,</span>
+                         <span class="n">qy_min</span> <span class="o">=</span> <span class="n">qy_min</span><span class="p">,</span>
+                         <span class="n">qy_max</span> <span class="o">=</span> <span class="n">qy_max</span><span class="p">,</span>
+                         <span class="n">image</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">image</span><span class="p">,</span>
+                         <span class="n">completefn</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">)</span>
+            <span class="c">#self.image = map(self._map_func, self.qx, self.qy, </span>
+            <span class="c">#                 qx_min, qx_max, qy_min, qy_max)[0]</span>
+            <span class="n">cal_res</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Computation is in progress...&quot;</span>
+            <span class="c">#msg = &quot;Finished the resolution computation...&quot;</span>
+            <span class="n">status_type</span> <span class="o">=</span> <span class="s">&#39;progress&#39;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">status_type</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">raise</span>
+            </div>
+<div class="viewcode-block" id="ResolutionCalculatorPanel.complete"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolution_calculator_panel.ResolutionCalculatorPanel.complete">[docs]</a>    <span class="k">def</span> <span class="nf">complete</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">image</span><span class="p">,</span> <span class="n">elapsed</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Callafter complete: wx call after needed for stable output</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">complete_cal</span><span class="p">,</span> <span class="n">image</span><span class="p">,</span> <span class="n">elapsed</span><span class="p">)</span>   
+        </div>
+<div class="viewcode-block" id="ResolutionCalculatorPanel.complete_cal"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolution_calculator_panel.ResolutionCalculatorPanel.complete_cal">[docs]</a>    <span class="k">def</span> <span class="nf">complete_cal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">image</span><span class="p">,</span> <span class="n">elapsed</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Complete computation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">image</span> <span class="o">=</span> <span class="n">image</span>
+        <span class="c"># Draw lines in image before drawing</span>
+        <span class="n">wave_list</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">get_wave_list</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">wave_list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="ow">and</span> <span class="n">wave_list</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="nb">max</span><span class="p">(</span><span class="n">wave_list</span><span class="p">):</span>
+            <span class="c"># draw a green rectangle(limit for the longest wavelength </span>
+            <span class="c"># to be involved) for tof inputs</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_draw_lines</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">image</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">&#39;g&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_draw_lines</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">image</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">&#39;r&#39;</span><span class="p">)</span>
+        <span class="c"># Draw image</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">image</span><span class="o">.</span><span class="n">draw</span><span class="p">()</span>
+        <span class="c">#self.vertical_r_sizer.Layout()</span>
+        
+        <span class="c"># Get and format the sigmas </span>
+        <span class="n">sigma_r</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sigma_1</span><span class="p">)</span>
+        <span class="n">sigma_phi</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sigma_2</span><span class="p">)</span>
+        <span class="n">sigma_lamd</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sigma_lamd</span><span class="p">)</span>
+        <span class="n">sigma_1d</span> <span class="o">=</span>  <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sigma_1d</span><span class="p">)</span>
+
+        <span class="c"># Set output values </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_r_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sigma_r</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_phi_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sigma_phi</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_lamd_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sigma_lamd</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_1d_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sigma_1d</span><span class="p">))</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sigma_strings</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">status_type</span> <span class="o">=</span> <span class="s">&#39;stop&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">status_type</span><span class="p">)</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_draw_lines</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">image</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">&#39;r&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw lines in image if applicable</span>
+<span class="sd">        : Param image: pylab object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">image</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="n">color</span> <span class="o">==</span> <span class="s">&#39;g&#39;</span><span class="p">:</span>
+            <span class="c"># Get the params from resolution</span>
+            <span class="c"># ploting range for largest wavelength</span>
+            <span class="n">qx_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qx_min</span>
+            <span class="n">qx_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qx_max</span>
+            <span class="n">qy_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qy_min</span>
+            <span class="n">qy_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qy_max</span>
+            <span class="c"># detector range</span>
+            <span class="n">detector_qx_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_qx_min</span>
+            <span class="n">detector_qx_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_qx_max</span>
+            <span class="n">detector_qy_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_qy_min</span>
+            <span class="n">detector_qy_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_qy_max</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">qx_min</span><span class="p">,</span> <span class="n">qx_max</span><span class="p">,</span> <span class="n">qy_min</span><span class="p">,</span> <span class="n">qy_max</span> <span class="o">=</span> \
+                                <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">get_detector_qrange</span><span class="p">()</span>
+            <span class="c"># detector range</span>
+            <span class="n">detector_qx_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qxmin_limit</span>
+            <span class="n">detector_qx_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qxmax_limit</span>
+            <span class="n">detector_qy_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qymin_limit</span>
+            <span class="n">detector_qy_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">qymax_limit</span>
+
+        <span class="c"># Draw zero axis lines</span>
+        <span class="k">if</span> <span class="n">qy_min</span> <span class="o">&lt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">qy_max</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">image</span><span class="o">.</span><span class="n">axhline</span><span class="p">(</span><span class="n">linewidth</span> <span class="o">=</span> <span class="mi">1</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">qx_min</span> <span class="o">&lt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">qx_max</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">image</span><span class="o">.</span><span class="n">axvline</span><span class="p">(</span><span class="n">linewidth</span> <span class="o">=</span> <span class="mi">1</span><span class="p">)</span>
+            
+        <span class="c"># Find x and y ratio values to draw the detector outline</span>
+        <span class="n">x_min</span> <span class="o">=</span> <span class="n">fabs</span><span class="p">(</span><span class="n">detector_qx_min</span> <span class="o">-</span> <span class="n">qx_min</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">qx_max</span> <span class="o">-</span> <span class="n">qx_min</span><span class="p">)</span>
+        <span class="n">x_max</span> <span class="o">=</span> <span class="n">fabs</span><span class="p">(</span><span class="n">detector_qx_max</span> <span class="o">-</span> <span class="n">qx_min</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">qx_max</span> <span class="o">-</span> <span class="n">qx_min</span><span class="p">)</span>
+        <span class="n">y_min</span> <span class="o">=</span> <span class="n">fabs</span><span class="p">(</span><span class="n">detector_qy_min</span> <span class="o">-</span> <span class="n">qy_min</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">qy_max</span> <span class="o">-</span> <span class="n">qy_min</span><span class="p">)</span>
+        <span class="n">y_max</span> <span class="o">=</span> <span class="n">fabs</span><span class="p">(</span><span class="n">detector_qy_max</span> <span class="o">-</span> <span class="n">qy_min</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">qy_max</span> <span class="o">-</span> <span class="n">qy_min</span><span class="p">)</span>
+
+        <span class="c"># Draw Detector outline</span>
+        <span class="k">if</span> <span class="n">detector_qy_min</span> <span class="o">&gt;=</span> <span class="n">qy_min</span><span class="p">:</span>
+            <span class="n">image</span><span class="o">.</span><span class="n">axhline</span><span class="p">(</span><span class="n">y</span> <span class="o">=</span> <span class="n">detector_qy_min</span> <span class="o">+</span> <span class="mf">0.0002</span><span class="p">,</span>
+                               <span class="n">xmin</span> <span class="o">=</span> <span class="n">x_min</span><span class="p">,</span>
+                               <span class="n">xmax</span> <span class="o">=</span> <span class="n">x_max</span><span class="p">,</span> 
+                               <span class="n">linewidth</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">detector_qy_max</span> <span class="o">&lt;=</span> <span class="n">qy_max</span><span class="p">:</span>
+            <span class="n">image</span><span class="o">.</span><span class="n">axhline</span><span class="p">(</span><span class="n">y</span> <span class="o">=</span> <span class="n">detector_qy_max</span> <span class="o">-</span> <span class="mf">0.0002</span><span class="p">,</span> 
+                               <span class="n">xmin</span> <span class="o">=</span> <span class="n">x_min</span><span class="p">,</span> 
+                               <span class="n">xmax</span> <span class="o">=</span> <span class="n">x_max</span><span class="p">,</span> 
+                               <span class="n">linewidth</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">detector_qx_min</span> <span class="o">&gt;=</span> <span class="n">qx_min</span><span class="p">:</span>
+            <span class="n">image</span><span class="o">.</span><span class="n">axvline</span><span class="p">(</span><span class="n">x</span> <span class="o">=</span> <span class="n">detector_qx_min</span> <span class="o">+</span> <span class="mf">0.0002</span><span class="p">,</span> 
+                               <span class="n">ymin</span> <span class="o">=</span> <span class="n">y_min</span><span class="p">,</span> 
+                               <span class="n">ymax</span> <span class="o">=</span> <span class="n">y_max</span><span class="p">,</span> 
+                               <span class="n">linewidth</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">detector_qx_max</span> <span class="o">&lt;=</span> <span class="n">qx_max</span><span class="p">:</span>
+            <span class="n">image</span><span class="o">.</span><span class="n">axvline</span><span class="p">(</span><span class="n">x</span> <span class="o">=</span> <span class="n">detector_qx_max</span> <span class="o">-</span> <span class="mf">0.0002</span><span class="p">,</span> 
+                               <span class="n">ymin</span> <span class="o">=</span> <span class="n">y_min</span><span class="p">,</span> 
+                               <span class="n">ymax</span> <span class="o">=</span> <span class="n">y_max</span><span class="p">,</span> 
+                               <span class="n">linewidth</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">)</span>
+        <span class="n">xmin</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qx</span><span class="p">)</span>
+        <span class="n">xmax</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qx</span><span class="p">)</span>
+        <span class="n">ymin</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qy</span><span class="p">)</span>
+        <span class="n">ymax</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qy</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">color</span> <span class="o">!=</span> <span class="s">&#39;g&#39;</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">xmin</span> <span class="o">&lt;</span> <span class="n">detector_qx_min</span> <span class="ow">or</span> <span class="n">xmax</span> <span class="o">&gt;</span> <span class="n">detector_qx_max</span> <span class="ow">or</span> \
+                        <span class="n">ymin</span> <span class="o">&lt;</span> <span class="n">detector_qy_min</span> <span class="ow">or</span> <span class="n">ymax</span> <span class="o">&gt;</span> <span class="n">detector_qy_max</span><span class="p">:</span>
+                <span class="c"># message</span>
+                <span class="n">status_type</span> <span class="o">=</span> <span class="s">&#39;stop&#39;</span> 
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;At least one q value located out side of</span><span class="se">\n</span><span class="s">&#39;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; the detector range (</span><span class="si">%s</span><span class="s"> &lt; qx &lt; </span><span class="si">%s</span><span class="s">, </span><span class="si">%s</span><span class="s"> &lt; qy &lt; </span><span class="si">%s</span><span class="s">),</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> \
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="n">detector_qx_min</span><span class="p">),</span> 
+                         <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="n">detector_qx_max</span><span class="p">),</span>
+                         <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="n">detector_qy_min</span><span class="p">),</span> 
+                         <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="n">detector_qy_max</span><span class="p">))</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; is ignored in computation.</span><span class="se">\n</span><span class="s">&quot;</span>
+                
+                <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">status_type</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Warning&#39;</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_map_func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">qx</span><span class="p">,</span> <span class="n">qy</span><span class="p">,</span> <span class="n">qx_min</span><span class="p">,</span> <span class="n">qx_max</span><span class="p">,</span> <span class="n">qy_min</span><span class="p">,</span> <span class="n">qy_max</span><span class="p">):</span>    
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Prepare the Mapping for the computation</span>
+<span class="sd">        : params qx, qy, qx_min, qx_max, qy_min, qy_max:</span>
+<span class="sd">        </span>
+<span class="sd">        : return: image (pylab)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">qx_value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">qx</span><span class="p">)</span>
+            <span class="n">qy_value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">qy</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">raise</span>
+        <span class="c"># calculate 2D resolution distribution image</span>
+        <span class="n">image</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">compute_and_plot</span><span class="p">(</span><span class="n">qx_value</span><span class="p">,</span> <span class="n">qy_value</span><span class="p">,</span> 
+                                 <span class="n">qx_min</span><span class="p">,</span> <span class="n">qx_max</span><span class="p">,</span> <span class="n">qy_min</span><span class="p">,</span> <span class="n">qy_max</span><span class="p">,</span> 
+                                 <span class="bp">self</span><span class="o">.</span><span class="n">det_coordinate</span><span class="p">)</span>
+        <span class="c"># record sigmas</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_strings</span> <span class="o">+=</span> <span class="s">&quot; At Qx = </span><span class="si">%s</span><span class="s">, Qy = </span><span class="si">%s</span><span class="s">; </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="n">qx_value</span><span class="p">,</span> <span class="n">qy_value</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sigma_strings</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">image</span>
+    <span class="k">def</span> <span class="nf">_sigma_strings</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Recode sigmas as strins</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">sigma_r</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sigma_1</span><span class="p">)</span>
+        <span class="n">sigma_phi</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sigma_2</span><span class="p">)</span>
+        <span class="n">sigma_lamd</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sigma_lamd</span><span class="p">)</span>
+        <span class="n">sigma_1d</span> <span class="o">=</span>  <span class="bp">self</span><span class="o">.</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sigma_1d</span><span class="p">)</span>
+        <span class="c"># Set output values </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_strings</span> <span class="o">+=</span> <span class="s">&quot;   sigma_x = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="n">sigma_r</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_strings</span> <span class="o">+=</span> <span class="s">&quot;   sigma_y = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="n">sigma_phi</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_strings</span> <span class="o">+=</span> <span class="s">&quot;   sigma_lamd = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="n">sigma_lamd</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_strings</span> <span class="o">+=</span> <span class="s">&quot;   sigma_1D = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="n">sigma_1d</span>
+    
+    <span class="k">def</span> <span class="nf">_validate_q_input</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">qx</span><span class="p">,</span> <span class="n">qy</span><span class="p">):</span>    
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check if q inputs are valid</span>
+<span class="sd">        : params qx:  qx as a list</span>
+<span class="sd">        : params qy:  qy as a list</span>
+<span class="sd">        </span>
+<span class="sd">        : return: True/False</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># check qualifications</span>
+        <span class="k">if</span> <span class="n">qx</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&#39;list&#39;</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">qy</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&#39;list&#39;</span> <span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">qx</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">qy</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="c"># allow one input</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">qx</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">qy</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="n">qx</span> <span class="o">=</span> <span class="p">[</span><span class="n">qx</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">qy</span><span class="p">))]</span>
+            <span class="c">#self.qx = qx</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">qy</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">qx</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="n">qy</span> <span class="o">=</span> <span class="p">[</span><span class="n">qy</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">qx</span><span class="p">))]</span>
+            <span class="c">#self.qy = qy</span>
+        <span class="c"># check length</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">qx</span><span class="p">)</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">qy</span><span class="p">):</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">qx</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">qy</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">return</span> <span class="n">qx</span><span class="p">,</span> <span class="n">qy</span> 
+     
+<div class="viewcode-block" id="ResolutionCalculatorPanel.on_reset"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolution_calculator_panel.ResolutionCalculatorPanel.on_reset">[docs]</a>    <span class="k">def</span> <span class="nf">on_reset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Execute the reset</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># skip for another event</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>  
+        <span class="c"># init resolution_calculator</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span> <span class="o">=</span> <span class="n">ResolutionCalculator</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">get_all_instrument_params</span><span class="p">()</span>
+        <span class="c"># reset all param values</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;Neutron&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_source_selection</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wave_color_cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;Monochromatic&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_source_color</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="c">#self.intensity_tcl.SetValue(str(self.resolution.intensity))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="mf">6.0</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="mf">0.125</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_spectrum</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">spectrum_dic</span><span class="p">[</span><span class="s">&#39;Flat&#39;</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_txt</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">source_aperture_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">source_aperture_size</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">source_aperture_size</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">source_aperture_value</span> <span class="o">+=</span> <span class="s">&quot;, &quot;</span>
+            <span class="n">source_aperture_value</span> <span class="o">+=</span> \
+                <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">source_aperture_size</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source_aperture_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source_aperture_value</span><span class="p">))</span>
+        <span class="n">sample_aperture_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sample_aperture_size</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sample_aperture_size</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">sample_aperture_value</span> <span class="o">+=</span> <span class="s">&quot;, &quot;</span>
+            <span class="n">sample_aperture_value</span> <span class="o">+=</span> \
+                <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sample_aperture_size</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_aperture_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">sample_aperture_value</span><span class="p">)</span>
+        <span class="n">source2sample_distance_value</span> <span class="o">=</span> \
+            <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">source2sample_distance</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source2sample_distance_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">source2sample_distance_value</span><span class="p">)</span>
+        <span class="n">sample2sample_distance_value</span> <span class="o">=</span> \
+            <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sample2sample_distance</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2sample_distance_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">sample2sample_distance_value</span><span class="p">)</span>
+        <span class="n">sample2detector_distance_value</span> <span class="o">=</span> \
+            <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">sample2detector_distance</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample2detector_distance_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span>\
+                                            <span class="n">sample2detector_distance_value</span><span class="p">)</span>
+        <span class="n">detector_size_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_size</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_size</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">detector_size_value</span> <span class="o">+=</span> <span class="s">&quot;, &quot;</span>
+            <span class="n">detector_size_value</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_size</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">detector_size_value</span><span class="p">)</span>
+        <span class="n">detector_pix_size_value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_pix_size</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_pix_size</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">detector_pix_size_value</span> <span class="o">+=</span> <span class="s">&quot;, &quot;</span>
+            <span class="n">detector_pix_size_value</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">detector_pix_size</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">detector_pix_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">detector_pix_size_value</span><span class="p">)</span>
+        <span class="c">#layout attribute</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># reset q inputs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qx_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">_Q_DEFAULT</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qy_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">_Q_DEFAULT</span><span class="p">))</span>
+        <span class="c"># reset sigma outputs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_r_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_phi_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_1d_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="c"># reset radio button</span>
+        <span class="c">#self.r_phi_rb.SetValue(True)</span>
+        <span class="c"># Finally re-compute</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_compute</span><span class="p">()</span>
+        <span class="c"># msg on info</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Finished the resetting...&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;stop&#39;</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="ResolutionCalculatorPanel.format_number"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolution_calculator_panel.ResolutionCalculatorPanel.format_number">[docs]</a>    <span class="k">def</span> <span class="nf">format_number</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return a float in a standardized, human-readable formatted string </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span> 
+            <span class="n">value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">output</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">return</span> <span class="n">output</span>
+
+        <span class="n">output</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%-7.4g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span>
+        <span class="k">return</span> <span class="n">output</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>  
+     </div>
+    <span class="k">def</span> <span class="nf">_string2list</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">string</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change NNN, NNN to list,ie. [NNN, NNN] where NNN is a number</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">new_string</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># check the number of floats </span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">strg</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
+            <span class="n">new_string</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">strg</span><span class="p">)</span>
+            <span class="c">#new_string.append(0)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">string_split</span> <span class="o">=</span> <span class="n">string</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;,&#39;</span><span class="p">)</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">string_split</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+                <span class="n">str_1</span> <span class="o">=</span> <span class="n">string_split</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="n">str_2</span> <span class="o">=</span> <span class="n">string_split</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="n">new_string</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">str_1</span><span class="p">))</span>
+                <span class="n">new_string</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">str_2</span><span class="p">))</span>
+            <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">string_split</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="n">str_1</span> <span class="o">=</span> <span class="n">string_split</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="n">new_string</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">str_1</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;The numbers must be one or two (separated by &#39;,&#39;)...&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_status_info</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;stop&#39;</span><span class="p">)</span>
+                <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">msg</span>
+
+        <span class="k">return</span> <span class="n">new_string</span>
+    
+    <span class="k">def</span> <span class="nf">_string2inputlist</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">string</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change NNN, NNN,... to list,ie. [NNN, NNN,...] where NNN is a number</span>
+<span class="sd">        </span>
+<span class="sd">        : return new_string: string like list</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">new_string</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">string_split</span> <span class="o">=</span> <span class="n">string</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;,&#39;</span><span class="p">)</span>
+        <span class="n">length</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">string_split</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">length</span><span class="p">):</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">string_split</span><span class="p">[</span><span class="n">ind</span><span class="p">])</span>
+                <span class="n">new_string</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+        
+        <span class="k">return</span> <span class="n">new_string</span>
+    
+    <span class="k">def</span> <span class="nf">_str2longlist</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">string</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change NNN, NNN,... to list, NNN - NNN ; NNN to list, or float to list</span>
+<span class="sd">        </span>
+<span class="sd">        : return new_string: string like list</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#new_string = []</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Wrong format of intputs.&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># is float</span>
+            <span class="n">out</span> <span class="o">=</span> <span class="p">[</span><span class="nb">float</span><span class="p">(</span><span class="n">string</span><span class="p">)]</span>
+            <span class="k">return</span> <span class="n">out</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">wave_color</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;mono&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Warning&#39;</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="c"># has a &#39;-&#39; </span>
+                    <span class="k">if</span> <span class="n">string</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;-&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">value</span> <span class="o">=</span> <span class="n">string</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;-&#39;</span><span class="p">)</span>
+                        <span class="k">if</span> <span class="n">value</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;;&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                            <span class="c"># has a &#39;;&#39;</span>
+                            <span class="n">last_list</span> <span class="o">=</span> <span class="n">value</span><span class="p">[</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>
+                            <span class="n">num</span> <span class="o">=</span>  <span class="n">math</span><span class="o">.</span><span class="n">ceil</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">last_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
+                            <span class="nb">max</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">last_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">num_wave</span> <span class="o">=</span> <span class="n">num</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="c"># default num</span>
+                            <span class="n">num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">num_wave</span>
+                            <span class="nb">max</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">value</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                        <span class="nb">min</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">value</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+                        <span class="c"># make a list</span>
+                        <span class="n">bin_size</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="nb">max</span> <span class="o">-</span> <span class="nb">min</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">num</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span>
+                        <span class="n">out</span> <span class="o">=</span> <span class="p">[</span><span class="nb">min</span> <span class="o">+</span> <span class="n">bin_size</span> <span class="o">*</span> <span class="n">bnum</span> <span class="k">for</span> <span class="n">bnum</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">num</span><span class="p">)]</span>
+                        <span class="k">return</span> <span class="n">out</span>
+                    <span class="k">if</span> <span class="n">string</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;,&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">out</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_string2inputlist</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
+                        <span class="k">return</span> <span class="n">out</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>
+                <span class="c">#    wx.MessageBox(msg, &#39;Warning&#39;)</span>
+
+    <span class="k">def</span> <span class="nf">_on_xy_coordinate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the detector coordinate for sigmas to x-y coordinate</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>        
+        <span class="c"># Set the coordinate in Cartesian       </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">det_coordinate</span> <span class="o">=</span> <span class="s">&#39;cartesian&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_r_txt</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&#39;Sigma_x:&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_phi_txt</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&#39;Sigma_y:&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_onparamEnter</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_on_rp_coordinate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the detector coordinate for sigmas to polar coordinate</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>        
+        <span class="c"># Set the coordinate in polar            </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">det_coordinate</span> <span class="o">=</span> <span class="s">&#39;polar&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_r_txt</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&#39;Sigma_r:   &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sigma_phi_txt</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&#39;Sigma_phi:&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_onparamEnter</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_status_info</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;&#39;</span><span class="p">,</span> <span class="nb">type</span> <span class="o">=</span> <span class="s">&quot;update&quot;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Status msg</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">type</span> <span class="o">==</span> <span class="s">&quot;stop&quot;</span><span class="p">:</span>
+            <span class="n">label</span> <span class="o">=</span> <span class="s">&quot;Compute&quot;</span>
+            <span class="n">able</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">else</span><span class="p">:</span>   
+            <span class="n">label</span> <span class="o">=</span> <span class="s">&quot;Wait...&quot;</span>
+            <span class="n">able</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_button</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="n">able</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_button</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">label</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_button</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">label</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                             <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span> <span class="o">=</span> <span class="n">msg</span><span class="p">,</span> <span class="nb">type</span> <span class="o">=</span> <span class="nb">type</span> <span class="p">))</span>
+
+
+    <span class="k">def</span> <span class="nf">_onparamEnter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span> <span class="o">=</span> <span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Text_enter_callback, perform compute</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_compute</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_on_source_selection</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span> <span class="o">=</span> <span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On source combobox selection</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">combo</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">combo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">source_cb</span>
+        <span class="n">selection</span> <span class="o">=</span> <span class="n">combo</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="n">mass</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">source_mass</span><span class="p">[</span><span class="n">selection</span><span class="p">]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_neutron_mass</span><span class="p">(</span><span class="n">mass</span><span class="p">)</span>   
+        <span class="n">source_hint</span> <span class="o">=</span> <span class="s">&quot;Source Selection: Affect on&quot;</span>
+        <span class="n">source_hint</span> <span class="o">+=</span> <span class="s">&quot; the gravitational contribution.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">source_hint</span> <span class="o">+=</span> <span class="s">&quot;Mass of </span><span class="si">%s</span><span class="s">: m = </span><span class="si">%s</span><span class="s"> [g]&quot;</span> <span class="o">%</span> \
+                            <span class="p">(</span><span class="n">selection</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">get_neutron_mass</span><span class="p">()))</span>
+        <span class="c">#source_tip.SetTip(source_hint)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mass_txt</span><span class="o">.</span><span class="n">ToolTip</span><span class="o">.</span><span class="n">SetTip</span><span class="p">(</span><span class="n">source_hint</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_on_source_color</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span> <span class="o">=</span> <span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On source color combobox selection</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c">#combo = event.GetEventObject()</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="c">#else:</span>
+        <span class="n">combo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wave_color_cb</span>
+        <span class="n">selection</span> <span class="o">=</span> <span class="n">combo</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wave_color</span> <span class="o">=</span> <span class="n">selection</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">wave_color</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;tof&#39;</span><span class="p">:</span>
+            <span class="nb">list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">get_wave_list</span><span class="p">()</span>
+            <span class="n">minw</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">:</span>
+                <span class="n">maxw</span> <span class="o">=</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">minw</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">maxw</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%s</span><span class="s"> - </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">minw</span><span class="p">,</span> <span class="n">maxw</span><span class="p">))</span>
+            <span class="n">minw</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+            <span class="n">maxw</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%s</span><span class="s"> - </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">minw</span><span class="p">,</span> <span class="n">maxw</span><span class="p">))</span>
+            <span class="n">spectrum_val</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_spectrum</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">spectrum_dic</span><span class="p">[</span><span class="n">spectrum_val</span><span class="p">])</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_txt</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+          
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">wavelength</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">get_wavelength</span><span class="p">()</span>
+            <span class="n">wavelength_spread</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">get_wavelength_spread</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">wavelength</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">wavelength_spread</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_spectrum</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">spectrum_dic</span><span class="p">[</span><span class="s">&#39;Flat&#39;</span><span class="p">])</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_txt</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_sizer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_on_spectrum_cb</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On spectrum ComboBox event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c">#combo = event.GetEventObject()</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">raise</span>
+        <span class="n">selection</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">selection</span> <span class="o">==</span> <span class="s">&#39;Add new&#39;</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_selectDlg</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">path</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;Flat&#39;</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_spectrum</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">spectrum_dic</span><span class="p">[</span><span class="s">&#39;Flat&#39;</span><span class="p">])</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;No file has been chosen.&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+                <span class="k">return</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">basename</span>  <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">basename</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_dic</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_dic</span><span class="p">[</span><span class="n">basename</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_read_file</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">spectrum_cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_spectrum</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">spectrum_dic</span><span class="p">[</span><span class="n">basename</span><span class="p">])</span>
+                <span class="k">return</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">raise</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">resolution</span><span class="o">.</span><span class="n">set_spectrum</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">spectrum_dic</span><span class="p">[</span><span class="n">selection</span><span class="p">])</span>
+                             
+    <span class="k">def</span> <span class="nf">_selectDlg</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        open a dialog file to select a customized spectrum</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <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="bp">self</span><span class="p">,</span> 
+                <span class="s">&quot;Choose a wavelength spectrum file: Intensity vs. wavelength&quot;</span><span class="p">,</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_save_location</span><span class="p">()</span> <span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">,</span> 
+                <span class="s">&quot;*.*&quot;</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">OPEN</span><span class="p">)</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">path</span>
+        
+    <span class="k">def</span> <span class="nf">_read_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Read two columns file as tuples of numpy array</span>
+<span class="sd">        </span>
+<span class="sd">        :param path: the path to the file to read</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">path</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span>\
+                            <span class="s">&quot; Selected Distribution was not loaded: </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="n">path</span><span class="p">))</span>
+                <span class="k">return</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span>
+            <span class="n">input_f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="s">&#39;r&#39;</span><span class="p">)</span>
+            <span class="n">buff</span> <span class="o">=</span> <span class="n">input_f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+            <span class="n">lines</span> <span class="o">=</span> <span class="n">buff</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
+            
+            <span class="n">wavelength</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="n">intensity</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span>
+                <span class="n">toks</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">wave</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+                    <span class="n">intens</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">toks</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                    <span class="n">wavelength</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">wave</span><span class="p">)</span>
+                    <span class="n">intensity</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">intens</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="c"># Skip non-data lines</span>
+                    <span class="k">pass</span>
+                
+            <span class="k">return</span> <span class="p">[</span><span class="n">wavelength</span><span class="p">,</span> <span class="n">intensity</span><span class="p">]</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">raise</span> 
+        </div>
+<div class="viewcode-block" id="ResolutionWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolution_calculator_panel.ResolutionWindow">[docs]</a><span class="k">class</span> <span class="nc">ResolutionWindow</span><span class="p">(</span><span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Resolution Window</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                 <span class="n">title</span> <span class="o">=</span> <span class="s">&quot;SAS Resolution Estimator&quot;</span><span class="p">,</span>
+                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span> <span class="o">*</span> <span class="mi">2</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">),</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">size</span>
+        <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">ResolutionCalculatorPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</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_CLOSE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnClose</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetPosition</span><span class="p">((</span><span class="mi">25</span><span class="p">,</span> <span class="mi">150</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="ResolutionWindow.OnClose"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.resolution_calculator_panel.ResolutionWindow.OnClose">[docs]</a>    <span class="k">def</span> <span class="nf">OnClose</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On close event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">_pylab_helpers</span><span class="o">.</span><span class="n">Gcf</span><span class="o">.</span><span class="n">figs</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">cal_res_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span> 
+
+        </div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">app</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">PySimpleApp</span><span class="p">()</span>
+    <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span>
+    <span class="n">frame</span> <span class="o">=</span> <span class="n">ResolutionWindow</span><span class="p">()</span>    
+    <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>     
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/sample_editor.html
===================================================================
--- _modules/sas/perspectives/calculator/sample_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/sample_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,647 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.sample_editor &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.sample_editor</h1><div class="highlight"><pre>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">deepcopy</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">check_float</span>
+
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">60</span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">450</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">430</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">480</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">550</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">430</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    
+<span class="k">class</span> <span class="nc">SampleDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+<div class="viewcode-block" id="SampleDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog">[docs]</a>    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">sample</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">),</span><span class="n">title</span><span class="o">=</span><span class="s">&#39;Sample Editor&#39;</span><span class="p">):</span>
+       
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span> <span class="o">=</span> <span class="n">sample</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">sample</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_description</span> <span class="o">=</span> <span class="s">&quot;Edit Sample&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+    
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            define initial sizer </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_sample</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="nb">str</span><span class="p">(</span><span class="s">&quot;Sample&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_sample</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_sample</span><span class="p">,</span>
+                                                    <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">id_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">thickness_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">transmission_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">temperature_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">position_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+       
+    <span class="k">def</span> <span class="nf">_layout_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for sample name related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Short name for sample [string]</span>
+        <span class="n">sample_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Sample Name : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_name_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">5</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">sample_name_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sample_name_tcl</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">EXPAND</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_layout_id</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for id related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## ID [String]</span>
+        <span class="n">id_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;ID: &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">id_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">id_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">id_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">55</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_thickness</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for thickness related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Thickness [float] [mm]</span>
+        <span class="n">thickness_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Thickness:&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">thickness_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                          <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span><span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="n">thickness_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">thickness_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                              <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">thickness_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">thickness_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">thickness_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">25</span><span class="p">),</span>
+                            <span class="p">(</span><span class="n">thickness_unit_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">thickness_unit_tcl</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">EXPAND</span><span class="p">)])</span> 
+    <span class="k">def</span> <span class="nf">_layout_transmission</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for transmission related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Transmission [float] [fraction]</span>
+        <span class="n">transmission</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">transmission_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Transmission:&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">transmission_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span><span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>   
+        <span class="bp">self</span><span class="o">.</span><span class="n">transmission_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">transmission_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">transmission_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">12</span><span class="p">)])</span> 
+        
+    <span class="k">def</span> <span class="nf">_layout_temperature</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for temperature related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Temperature [float] [C]</span>
+        <span class="n">temperature_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Temperature:&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">temperature_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>   
+        <span class="n">temperature_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">temperature_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                            <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">temperature_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">temperature_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">temperature_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                <span class="p">(</span><span class="n">temperature_unit_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">temperature_unit_tcl</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">EXPAND</span><span class="p">)])</span>  
+    
+    <span class="k">def</span> <span class="nf">_layout_position</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for position related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Position [Vector] [mm]</span>
+        <span class="n">position_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Position:&#39;</span><span class="p">)</span> 
+        <span class="n">x_position_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;x = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_position_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">y_position_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;y = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_position_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">z_position_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;z = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_position_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="n">position_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">position_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">position_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">position_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">x_position_txt</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">LEFT</span><span class="p">,</span> <span class="mi">14</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_position_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">y_position_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_position_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">z_position_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_position_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">position_unit_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">position_unit_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_layout_orientation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for orientation related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Orientation [Vector] [degrees]</span>
+        <span class="n">orientation_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Orientation:&#39;</span><span class="p">)</span> 
+        <span class="n">x_orientation_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;x = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_orientation_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">y_orientation_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;y = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_orientation_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">z_orientation_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;z = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_orientation_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="n">orientation_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span><span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">orientation_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">x_orientation_txt</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">LEFT</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_orientation_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">y_orientation_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_orientation_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">z_orientation_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_orientation_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">orientation_unit_txt</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">EXPAND</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_unit_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_details</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for beam size name related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Details</span>
+        <span class="n">details</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">details_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Details: &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">details_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">5</span><span class="p">,</span><span class="n">_BOX_WIDTH</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_MULTILINE</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">HSCROLL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">details_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">details_tcl</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">EXPAND</span><span class="p">)])</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;Apply&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_apply</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Apply current changes to the sample.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;Cancel&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Cancel current changes.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_cancel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span><span class="s">&#39;Close&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close window.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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">LEFT</span><span class="p">,</span> <span class="mi">200</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">             Draw the current panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_id</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_thickness</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_transmission</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_temperature</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_position</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_orientation</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_details</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_sample</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">thickness_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">transmission_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">temperature_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">position_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">details_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_sample</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">reset_sample</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="SampleDialog.reset_sample"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.reset_sample">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Put initial values of the sample back to the current sample</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">ID</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">ID</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">thickness</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">thickness</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">thickness_unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">thickness_unit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">transmission</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">transmission</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">temperature</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">temperature</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">temperature_unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">temperature_unit</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">y</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position_unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">position_unit</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation_unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">orientation_unit</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">details</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_sample</span><span class="o">.</span><span class="n">details</span>
+        
+    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.set_manager">[docs]</a>        <span class="sd">&quot;&quot;&quot;    </span>
+<span class="sd">            Set manager of this window</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+    
+    <span class="k">def</span> <span class="nf">set_values</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.set_values"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.set_values">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            take the sample values of the current data and display them</span>
+<span class="sd">            through the panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">sample</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span>
+        <span class="c">#Name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sample</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+        <span class="c">#id </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">id_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sample</span><span class="o">.</span><span class="n">ID</span><span class="p">))</span>
+        <span class="c">#thickness</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">thickness_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sample</span><span class="o">.</span><span class="n">thickness</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">thickness_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sample</span><span class="o">.</span><span class="n">thickness_unit</span><span class="p">))</span>
+        <span class="c">#transmission</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">transmission_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sample</span><span class="o">.</span><span class="n">transmission</span><span class="p">))</span>
+        <span class="c">#temperature</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">temperature_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sample</span><span class="o">.</span><span class="n">temperature</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">temperature_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sample</span><span class="o">.</span><span class="n">temperature_unit</span><span class="p">))</span>
+        <span class="c">#position</span>
+        <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span> <span class="o">=</span> <span class="n">sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">y</span> <span class="p">,</span> <span class="n">sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">z</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_position_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_position_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">y</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_position_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">position_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sample</span><span class="o">.</span><span class="n">position_unit</span><span class="p">))</span>
+        <span class="c">#orientation</span>
+        <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span> 
+        <span class="n">z</span> <span class="o">=</span> <span class="n">sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_orientation_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_orientation_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">y</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_orientation_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">sample</span><span class="o">.</span><span class="n">orientation_unit</span><span class="p">))</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_details</span><span class="p">(</span><span class="n">sample</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">set_details</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sample</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.set_details"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.set_details">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            print details on the current sample</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#detail</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="k">if</span> <span class="n">sample</span><span class="o">.</span><span class="n">details</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">sample</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">sample</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;      </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">item</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">get_sample</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.get_sample"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.get_sample">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            return the current sample</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span>
+    
+    <span class="k">def</span> <span class="nf">get_notes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.get_notes"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.get_notes">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            return notes</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span>
+    
+    <span class="k">def</span> <span class="nf">on_change_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.on_change_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.on_change_name">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change the name of the sample</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sample_name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">name</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">name</span> <span class="o">!=</span> <span class="n">name</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change sample &#39;s &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;name from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+            
+    <span class="k">def</span> <span class="nf">on_change_id</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.on_change_id"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.on_change_id">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change id of the sample </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change id</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">id_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">ID</span> <span class="o">=</span> <span class="nb">id</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change ID from&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">ID</span><span class="p">,</span> <span class="nb">id</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">on_change_thickness</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.on_change_thickness"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.on_change_thickness">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change thickness</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+       <span class="c">#Change thickness</span>
+        <span class="n">thickness</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">thickness_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">thickness</span> <span class="o">=</span> <span class="n">thickness</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change thickness from&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">thickness</span><span class="p">,</span> <span class="n">thickness</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">on_change_transmission</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.on_change_transmission"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.on_change_transmission">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change transmission</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change transmission</span>
+        <span class="n">transmission</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">transmission_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">transmission</span> <span class="o">!=</span> <span class="n">transmission</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change transmission from&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">transmission</span><span class="p">,</span>
+                                              <span class="n">transmission</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">transmission</span> <span class="o">=</span> <span class="n">transmission</span>
+            
+    <span class="k">def</span> <span class="nf">on_change_temperature</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.on_change_temperature"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.on_change_temperature">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change temperature</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change temperature</span>
+        <span class="n">temperature</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">temperature_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">temperature</span> <span class="o">=</span> <span class="n">temperature</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change temperature from&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">temperature</span><span class="p">,</span> <span class="n">temperature</span><span class="p">)</span>
+        <span class="c">#change temperature unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">temperature_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">temperature_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change temperature&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">temperature_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">temperature_unit</span> <span class="o">=</span> <span class="n">unit</span>
+            
+    <span class="k">def</span> <span class="nf">on_change_position</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.on_change_position"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.on_change_position">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change position</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change x coordinate</span>
+        <span class="n">x_position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_position_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">x_position</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">x_position</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">x_position</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_position_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">x</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_position</span><span class="p">)</span> <span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change x of position from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                                     <span class="n">x_position</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">x</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_position</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the position &#39;s x &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes x position from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">x_position</span><span class="p">)</span>
+        <span class="c">#Change y coordinate</span>
+        <span class="n">y_position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_position_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">y_position</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">y_position</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">y_position</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">y_position</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_position_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">y</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_position</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change y of position from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">y</span><span class="p">,</span> 
+                                                    <span class="n">y_position</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">y</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_position</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the beam size&#39;s y &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes y position from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">y</span><span class="p">,</span> <span class="n">y_position</span><span class="p">)</span>
+        <span class="c">#Change z coordinate</span>
+        <span class="n">z_position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_position_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">z_position</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">z_position</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">z_position</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="n">z_position</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_position_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">z</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_position</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change z of position from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                                    <span class="n">z_position</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">z</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_position</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for position&#39;s x &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes z position from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">z</span><span class="p">,</span> <span class="n">z_position</span><span class="p">)</span>
+        <span class="c">#change the beam center unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">position_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change position&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">position_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            
+    <span class="k">def</span> <span class="nf">on_change_orientation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.on_change_orientation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.on_change_orientation">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change orientation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change x coordinate</span>
+        <span class="n">x_orientation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_orientation_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">x_orientation</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">x_orientation</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">x_orientation</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_orientation_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_orientation</span><span class="p">)</span> <span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change x of orientation from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                                   <span class="n">x_orientation</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_orientation</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for orientation &#39;s x &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes x orientation from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                              <span class="n">x_orientation</span><span class="p">)</span>
+        <span class="c">#Change y coordinate</span>
+        <span class="n">y_orientation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_orientation_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">y_orientation</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">y_orientation</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">y_orientation</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">y_orientation</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_orientation_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_orientation</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change y of orientation from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                                     <span class="n">y_orientation</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_orientation</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for orientation&#39;s y &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes y orientation from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                            <span class="n">y_orientation</span><span class="p">)</span>
+        <span class="c">#Change z coordinate</span>
+        <span class="n">z_orientation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_orientation_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">z_orientation</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">z_orientation</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">z_orientation</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="n">z_orientation</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_orientation_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_orientation</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change z of orientation from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                                     <span class="n">z_orientation</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_orientation</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for orientation &#39;s x &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes z orientation from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                              <span class="n">z_orientation</span><span class="p">)</span>
+        <span class="c">#change the beam center unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change orientation&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">orientation_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            
+    <span class="k">def</span> <span class="nf">on_change_details</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.on_change_details"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.on_change_details">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change details</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change details</span>
+        <span class="n">details</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">details_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">details</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="o">!=</span> <span class="n">details</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;      </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">item</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change details from&quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">details</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="o">.</span><span class="n">details</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">details</span><span class="p">)</span>
+  
+    <span class="k">def</span> <span class="nf">on_click_apply</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.on_click_apply"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.on_click_apply">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Apply user values to the sample</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_id</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_thickness</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_transmission</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_temperature</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_position</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_orientation</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_details</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_details</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">set_sample</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            
+    <span class="k">def</span> <span class="nf">on_click_cancel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+<div class="viewcode-block" id="SampleDialog.on_click_cancel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sample_editor.SampleDialog.on_click_cancel">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            leave the sample as it is and close</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_sample</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+             <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">set_sample</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sample</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div></div>
+    <span class="n">app</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">()</span>
+    <span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Sample</span>
+    <span class="n">sample</span> <span class="o">=</span> <span class="n">Sample</span><span class="p">()</span>
+    <span class="n">dlg</span> <span class="o">=</span> <span class="n">SampleDialog</span><span class="p">(</span><span class="n">sample</span><span class="o">=</span><span class="n">sample</span><span class="p">)</span>
+    <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>
+ 
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/sld_panel.html
===================================================================
--- _modules/sas/perspectives/calculator/sld_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/sld_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,580 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.sld_panel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.sld_panel</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">This module provide GUI for the neutron scattering length density calculator</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">math</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span>
+
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">format_number</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">check_float</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>  
+
+<span class="c"># the calculator default value for wavelength is 6</span>
+<span class="c">#import periodictable</span>
+<span class="kn">from</span> <span class="nn">periodictable</span> <span class="kn">import</span> <span class="n">formula</span>
+<span class="kn">from</span> <span class="nn">periodictable.xsf</span> <span class="kn">import</span> <span class="n">xray_energy</span>
+<span class="kn">from</span> <span class="nn">periodictable.xsf</span> <span class="kn">import</span> <span class="n">xray_sld_from_atoms</span>
+<span class="kn">from</span> <span class="nn">periodictable.nsf</span> <span class="kn">import</span> <span class="n">neutron_scattering</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator</span> <span class="kn">import</span> <span class="n">calculator_widgets</span> <span class="k">as</span> <span class="n">widget</span>   
+       
+<span class="n">WAVELENGTH</span> <span class="o">=</span> <span class="mf">6.0</span>
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">76</span>
+<span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">350</span>
+<span class="n">_SCALE</span> <span class="o">=</span> <span class="mf">1e-6</span>
+
+<span class="c">#SLD panel size </span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">350</span>
+    <span class="n">PANEL_SIZE</span> <span class="o">=</span> <span class="mi">400</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">380</span>
+    <span class="n">PANEL_SIZE</span> <span class="o">=</span> <span class="mi">410</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    
+<div class="viewcode-block" id="SldPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sld_panel.SldPanel">[docs]</a><span class="k">class</span> <span class="nc">SldPanel</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Panel</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Provides the SLD calculator GUI.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal nickname for the window, used by the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;SLD Calculator&quot;</span>
+    <span class="c">## Name to appear on the window title bar</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;SLD Calculator&quot;</span>
+    <span class="c">## Flag to tell the AUI manager to put this panel in the center pane</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">True</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Panel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="c">#Font size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="c"># Object that receive status event</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">=</span> <span class="n">base</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength</span> <span class="o">=</span> <span class="n">WAVELENGTH</span>
+        <span class="c">#layout attribute</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">density_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compound</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">density</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_real_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_im_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_real_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_im_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_real_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_im_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_abs_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_inc_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_length_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#Draw the panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+       
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw window content</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">unit_a</span> <span class="o">=</span> <span class="s">&#39;[A]&#39;</span>
+        <span class="n">unit_density</span> <span class="o">=</span> <span class="s">&#39;[g/cm^(3)]&#39;</span>
+        <span class="n">unit_sld</span> <span class="o">=</span> <span class="s">&#39;[1/A^(2)]&#39;</span>
+        <span class="n">unit_cm1</span> <span class="o">=</span> <span class="s">&#39;[1/cm]&#39;</span>
+        <span class="n">unit_cm</span> <span class="o">=</span> <span class="s">&#39;[cm]&#39;</span>
+        <span class="n">sizer_input</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">sizer_output</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">sizer_button</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>
+        <span class="n">sizer1</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>
+        <span class="n">sizer2</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>
+        <span class="n">sizer3</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>
+        <span class="c">#---------inputs----------------</span>
+        <span class="n">inputbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Input&quot;</span><span class="p">)</span>
+        <span class="n">boxsizer1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">inputbox</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_STATICBOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        
+        <span class="n">compound_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Compound &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">density_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Density &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">density_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">unit_density_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_density</span><span class="p">)</span>
+        <span class="n">wavelength_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Wavelength &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength</span><span class="p">))</span>
+        <span class="n">unit_a_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_a</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">compound_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">density_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">density_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span><span class="mi">1</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">unit_density_txt</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">wavelength_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_input</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">unit_a_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_input</span><span class="p">)</span>
+        <span class="n">sizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer1</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="c">#---------Outputs sizer--------</span>
+        <span class="n">outputbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Output&quot;</span><span class="p">)</span>
+        <span class="n">boxsizer2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">outputbox</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">boxsizer2</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_STATICBOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        
+        <span class="n">i_complex</span> <span class="o">=</span> <span class="s">&#39;- i&#39;</span>
+        <span class="n">neutron_sld_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Neutron SLD&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_real_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_real_ctl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_real_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Neutron SLD real.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_im_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_im_ctl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_im_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Neutron SLD imaginary.&quot;</span><span class="p">)</span>
+        <span class="n">neutron_sld_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_sld</span><span class="p">)</span>
+        
+        <span class="n">cu_ka_sld_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Cu Ka SLD&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_real_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                               <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_real_ctl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_real_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Cu Ka SLD real.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_im_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_im_ctl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_im_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Cu Ka SLD imaginary.&quot;</span><span class="p">)</span>
+        <span class="n">cu_ka_sld_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_sld</span><span class="p">)</span>
+        
+        <span class="n">mo_ka_sld_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Mo Ka SLD&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_real_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                               <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_real_ctl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_real_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Mo Ka SLD real.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_im_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_im_ctl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_im_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Mo Ka SLD imaginary.&quot;</span><span class="p">)</span>
+        <span class="n">mo_ka_sld_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_sld</span><span class="p">)</span>
+        
+        <span class="n">neutron_inc_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Neutron Inc. Xs&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_inc_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_inc_ctl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_inc_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Neutron Inc. Xs&quot;</span><span class="p">)</span>
+        <span class="n">neutron_inc_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>  <span class="n">unit_cm1</span><span class="p">)</span>
+       
+        <span class="n">neutron_abs_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Neutron Abs. Xs&#39;</span><span class="p">)</span>     
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_abs_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_abs_ctl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_abs_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Neutron Abs. Xs&quot;</span><span class="p">)</span>
+        <span class="n">neutron_abs_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>  <span class="n">unit_cm1</span><span class="p">)</span>
+      
+        <span class="n">neutron_length_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Neutron 1/e length&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_length_ctl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                               <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_length_ctl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_length_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Neutron 1/e length&quot;</span><span class="p">)</span>
+        <span class="n">neutron_length_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>  <span class="n">unit_cm</span><span class="p">)</span>
+      
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">neutron_sld_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_real_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">i_complex</span><span class="p">),</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_im_ctl</span><span class="p">,</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">neutron_sld_units_txt</span><span class="p">,</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">cu_ka_sld_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_real_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">i_complex</span><span class="p">),</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_im_ctl</span><span class="p">,</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>  
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">cu_ka_sld_units_txt</span><span class="p">,</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">mo_ka_sld_txt</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_real_ctl</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">i_complex</span><span class="p">),</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_im_ctl</span><span class="p">,</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>  
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">mo_ka_sld_units_txt</span><span class="p">,</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">neutron_inc_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">neutron_inc_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">2</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">neutron_inc_units_txt</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">neutron_abs_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">neutron_abs_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">2</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">neutron_abs_units_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">neutron_length_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">neutron_length_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">2</span>
+        <span class="n">sizer_output</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">neutron_length_units_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>  
+        <span class="n">boxsizer2</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_output</span><span class="p">)</span>
+        <span class="n">sizer2</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer2</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="c">#-----Button  sizer------------</span>
+    
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Calculate&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Calculate SLD.&quot;</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">calculateSld</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>   
+        
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">250</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</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">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="n">sizer3</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_button</span><span class="p">)</span>
+        <span class="c">#---------layout----------------</span>
+        <span class="n">vbox</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>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer1</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer2</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer3</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Fit</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="SldPanel.calculate_xray_sld"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sld_panel.SldPanel.calculate_xray_sld">[docs]</a>    <span class="k">def</span> <span class="nf">calculate_xray_sld</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">element</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get an element and compute the corresponding SLD for a given formula</span>
+<span class="sd">        </span>
+<span class="sd">        :param element:  elements a string of existing atom</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">myformula</span> <span class="o">=</span> <span class="n">formula</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">element</span><span class="p">))</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">myformula</span><span class="o">.</span><span class="n">atoms</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="n">element</span> <span class="o">=</span> <span class="n">myformula</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span> 
+        <span class="n">energy</span> <span class="o">=</span> <span class="n">xray_energy</span><span class="p">(</span><span class="n">element</span><span class="o">.</span><span class="n">K_alpha</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_formula</span> <span class="o">=</span> <span class="n">formula</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">compound</span><span class="p">),</span> <span class="n">density</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">density</span><span class="p">)</span>
+        <span class="n">atom</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_formula</span><span class="o">.</span><span class="n">atoms</span>
+        <span class="k">return</span> <span class="n">xray_sld_from_atoms</span><span class="p">(</span><span class="n">atom</span><span class="p">,</span> <span class="n">density</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">density</span><span class="p">,</span> <span class="n">energy</span><span class="o">=</span> <span class="n">energy</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="SldPanel.check_inputs"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sld_panel.SldPanel.check_inputs">[docs]</a>    <span class="k">def</span> <span class="nf">check_inputs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;Check validity user inputs&quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">density_ctl</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">density</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">density_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Error for Density value :expect float&quot;</span>
+    
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength</span><span class="p">)</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">wavelength</span> <span class="o">=</span> <span class="n">WAVELENGTH</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">WAVELENGTH</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Default value for wavelength is 6.0&quot;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_ctl</span><span class="p">):</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">wavelength</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Error for wavelength value :expect float&quot;</span>
+                
+        <span class="bp">self</span><span class="o">.</span><span class="n">compound</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">compound</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="k">try</span> <span class="p">:</span>
+                <span class="n">formula</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">compound</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Enter correct formula&quot;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">compound_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Enter a formula&quot;</span>
+        <span class="k">return</span> <span class="n">flag</span><span class="p">,</span> <span class="n">msg</span>
+        </div>
+<div class="viewcode-block" id="SldPanel.calculate_sld_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sld_panel.SldPanel.calculate_sld_helper">[docs]</a>    <span class="k">def</span> <span class="nf">calculate_sld_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">element</span><span class="p">,</span> <span class="n">density</span><span class="p">,</span> <span class="n">molecule_formula</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get an element and compute the corresponding SLD for a given formula</span>
+<span class="sd">        </span>
+<span class="sd">        :param element:  elements a string of existing atom</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">element_formula</span> <span class="o">=</span> <span class="n">formula</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">element</span><span class="p">))</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">element_formula</span><span class="o">.</span><span class="n">atoms</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="n">element</span> <span class="o">=</span> <span class="n">element_formula</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span> 
+        <span class="n">energy</span> <span class="o">=</span> <span class="n">xray_energy</span><span class="p">(</span><span class="n">element</span><span class="o">.</span><span class="n">K_alpha</span><span class="p">)</span>
+        <span class="n">atom</span> <span class="o">=</span> <span class="n">molecule_formula</span><span class="o">.</span><span class="n">atoms</span>
+        <span class="k">return</span> <span class="n">xray_sld_from_atoms</span><span class="p">(</span><span class="n">atom</span><span class="p">,</span> <span class="n">density</span><span class="o">=</span><span class="n">density</span><span class="p">,</span> <span class="n">energy</span><span class="o">=</span><span class="n">energy</span><span class="p">)</span>
+
+</div>
+<div class="viewcode-block" id="SldPanel.calculateSld"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sld_panel.SldPanel.calculateSld">[docs]</a>    <span class="k">def</span> <span class="nf">calculateSld</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Calculate the neutron scattering density length of a molecule</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">clear_outputs</span><span class="p">()</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c">#Check validity user inputs</span>
+            <span class="n">flag</span><span class="p">,</span> <span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">check_inputs</span><span class="p">()</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">msg</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;SLD Calculator: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+               <span class="k">return</span> 
+            <span class="c">#get ready to compute</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sld_formula</span> <span class="o">=</span> <span class="n">formula</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">compound</span><span class="p">,</span>
+                                            <span class="n">density</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">density</span><span class="p">)</span>
+            <span class="p">(</span><span class="n">sld_real</span><span class="p">,</span> <span class="n">sld_im</span><span class="p">,</span> <span class="n">_</span><span class="p">),</span> <span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">absorp</span><span class="p">,</span> <span class="n">incoh</span><span class="p">),</span> \
+                        <span class="n">length</span> <span class="o">=</span> <span class="n">neutron_scattering</span><span class="p">(</span><span class="n">compound</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">compound</span><span class="p">,</span>
+                                   <span class="n">density</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">density</span><span class="p">,</span> 
+                                   <span class="n">wavelength</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength</span><span class="p">)</span> 
+            <span class="n">cu_real</span><span class="p">,</span> <span class="n">cu_im</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">calculate_sld_helper</span><span class="p">(</span><span class="n">element</span><span class="o">=</span><span class="s">&quot;Cu&quot;</span><span class="p">,</span>
+                                                 <span class="n">density</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">density</span><span class="p">,</span>
+                                        <span class="n">molecule_formula</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_formula</span><span class="p">)</span>
+            <span class="n">mo_real</span><span class="p">,</span> <span class="n">mo_im</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">calculate_sld_helper</span><span class="p">(</span><span class="n">element</span><span class="o">=</span><span class="s">&quot;Mo&quot;</span><span class="p">,</span> 
+                                                       <span class="n">density</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">density</span><span class="p">,</span>
+                                     <span class="n">molecule_formula</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_formula</span><span class="p">)</span>
+            <span class="c"># set neutron sld values</span>
+            <span class="n">val</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="n">sld_real</span> <span class="o">*</span> <span class="n">_SCALE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_real_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+            <span class="n">val</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">sld_im</span><span class="p">)</span> <span class="o">*</span> <span class="n">_SCALE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_im_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+            <span class="c"># Compute the Cu SLD</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_real_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">cu_real</span> <span class="o">*</span><span class="n">_SCALE</span><span class="p">))</span>
+            <span class="n">val</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">cu_im</span> <span class="p">)</span><span class="o">*</span> <span class="n">_SCALE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_im_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+            <span class="c"># Compute the Mo SLD</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_real_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">mo_real</span> <span class="o">*</span><span class="n">_SCALE</span><span class="p">))</span>
+            <span class="n">val</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">mo_im</span><span class="p">)</span><span class="o">*</span> <span class="n">_SCALE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_im_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+            <span class="c"># set incoherence and absorption</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">neutron_inc_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">incoh</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">neutron_abs_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">absorp</span><span class="p">))</span>
+            <span class="c"># Neutron length</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">neutron_length_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">length</span><span class="p">))</span>
+            <span class="c"># display wavelength</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength</span><span class="p">))</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;SLD Calculator: </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">base</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            </div>
+<div class="viewcode-block" id="SldPanel.clear_outputs"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sld_panel.SldPanel.clear_outputs">[docs]</a>    <span class="k">def</span> <span class="nf">clear_outputs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Clear the outputs textctrl</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_real_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_sld_im_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_real_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mo_ka_sld_im_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_real_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cu_ka_sld_im_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_abs_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_inc_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">neutron_length_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        
+        </div></div>
+<div class="viewcode-block" id="SldWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sld_panel.SldWindow">[docs]</a><span class="k">class</span> <span class="nc">SldWindow</span><span class="p">(</span><span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;SLD Calculator&quot;</span><span class="p">,</span>
+                  <span class="n">base</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_SIZE</span><span class="p">,</span> <span class="n">PANEL_SIZE</span><span class="p">),</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">size</span>
+        <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">base</span> <span class="o">=</span> <span class="n">base</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">SldPanel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="n">base</span><span class="p">)</span>
+        <span class="bp">self</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_CLOSE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetPosition</span><span class="p">((</span><span class="mi">25</span><span class="p">,</span> <span class="mi">150</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="SldWindow.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sld_panel.SldWindow.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On close event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">sld_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        
+        </div></div>
+<div class="viewcode-block" id="ViewApp"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sld_panel.ViewApp">[docs]</a><span class="k">class</span> <span class="nc">ViewApp</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+<div class="viewcode-block" id="ViewApp.OnInit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.sld_panel.ViewApp.OnInit">[docs]</a>    <span class="k">def</span> <span class="nf">OnInit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">SldWindow</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&#39;SLD Calculator&#39;</span><span class="p">)</span>    
+        <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTopWindow</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">True</span>
+        
+</div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">app</span> <span class="o">=</span> <span class="n">ViewApp</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>     
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/slit_length_calculator_panel.html
===================================================================
--- _modules/sas/perspectives/calculator/slit_length_calculator_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/slit_length_calculator_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,379 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.slit_length_calculator_panel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.slit_length_calculator_panel</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">This software was developed by the University of Tennessee as part of the</span>
+<span class="sd">Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="sd">project funded by the US National Science Foundation. </span>
+
+<span class="sd">See the license text in license.txt</span>
+
+<span class="sd">copyright 2008, 2009, University of Tennessee</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">os</span>
+
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span>
+
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>  
+<span class="kn">from</span> <span class="nn">sas.calculator.slit_length_calculator</span> <span class="kn">import</span> <span class="n">SlitlengthCalculator</span>  
+<span class="kn">from</span> <span class="nn">calculator_widgets</span> <span class="kn">import</span> <span class="n">OutputTextCtrl</span>
+<span class="kn">from</span> <span class="nn">calculator_widgets</span> <span class="kn">import</span> <span class="n">InterActiveOutputTextCtrl</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator</span> <span class="kn">import</span> <span class="n">calculator_widgets</span> <span class="k">as</span> <span class="n">widget</span>   
+
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">76</span>
+<span class="c">#Slit length panel size </span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">200</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">530</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">210</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+ 
+<div class="viewcode-block" id="SlitLengthCalculatorPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.slit_length_calculator_panel.SlitLengthCalculatorPanel">[docs]</a><span class="k">class</span> <span class="nc">SlitLengthCalculatorPanel</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Panel</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Provides the slit length calculator GUI.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal nickname for the window, used by the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;Slit Size Calculator&quot;</span>
+    <span class="c">## Name to appear on the window title bar</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;Slit Size Calculator&quot;</span>
+    <span class="c">## Flag to tell the AUI manager to put this panel in the center pane</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">True</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Panel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="c">#Font size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="c">#thread to read data </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># Default location</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>  
+        <span class="c"># Object that receive status event</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+       
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Define the main sizers building to build this application.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_source</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="nb">str</span><span class="p">(</span><span class="s">&quot;Slit Size Calculator&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_source</span><span class="p">,</span>
+                                                    <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_size_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+       
+    <span class="k">def</span> <span class="nf">_layout_data_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Fill the sizer containing data&#39;s name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Data: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">4</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">data_hint</span> <span class="o">=</span> <span class="s">&quot;Loaded data&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">data_hint</span><span class="p">)</span>
+        <span class="c">#control that triggers importing data</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">browse_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Browse&quot;</span><span class="p">)</span>
+        <span class="n">hint_on_browse</span> <span class="o">=</span> <span class="s">&quot;Click on this button to import data in this panel.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">browse_button</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_on_browse</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_load_data</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">data_name_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">browse_button</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_layout_slit_size</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Fill the sizer containing slit size information</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">slit_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Slit Size (FWHM/2): &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_size_tcl</span> <span class="o">=</span> <span class="n">InterActiveOutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                       <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">slit_size_hint</span> <span class="o">=</span> <span class="s">&quot; Estimated full slit size&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_size_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">slit_size_hint</span><span class="p">)</span>
+        <span class="n">slit_size_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_size_unit_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span> 
+        <span class="n">slit_size_unit_hint</span> <span class="o">=</span> <span class="s">&quot;Full slit size&#39;s unit&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_size_unit_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">slit_size_unit_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_size_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">slit_size_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">slit_size_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                      <span class="p">(</span><span class="n">slit_size_unit_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">slit_size_unit_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_hint</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Fill the sizer containing hint </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;This calculation works only for  SAXSess beam profile data.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">hint_txt</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">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)])</span>
+    
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span><span class="s">&#39;Close&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close this window.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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">LEFT</span><span class="p">,</span> <span class="mi">390</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Draw window content</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_data_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_slit_size</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_hint</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">slit_size_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">hint_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="SlitLengthCalculatorPanel.choose_data_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.slit_length_calculator_panel.SlitLengthCalculatorPanel.choose_data_file">[docs]</a>    <span class="k">def</span> <span class="nf">choose_data_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">filename</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="k">if</span> <span class="n">location</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>
+        
+        <span class="n">wildcard</span> <span class="o">=</span> <span class="s">&quot;SAXSess Data 1D (*.DAT, *.dat)|*.DAT&quot;</span> 
+        
+        <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="bp">self</span><span class="p">,</span> <span class="s">&quot;Choose a file&quot;</span><span class="p">,</span> <span class="n">location</span><span class="p">,</span>
+                            <span class="s">&quot;&quot;</span><span class="p">,</span> <span class="n">wildcard</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">OPEN</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+            <span class="n">filename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        
+        <span class="k">return</span> <span class="n">path</span>
+</div>
+<div class="viewcode-block" id="SlitLengthCalculatorPanel.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.slit_length_calculator_panel.SlitLengthCalculatorPanel.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            close the window containing this panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">Close</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="SlitLengthCalculatorPanel.on_load_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.slit_length_calculator_panel.SlitLengthCalculatorPanel.on_load_data">[docs]</a>    <span class="k">def</span> <span class="nf">on_load_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Open a file dialog to allow the user to select a given file.</span>
+<span class="sd">            The user is only allow to load file with extension .DAT or .dat.</span>
+<span class="sd">            Display the slit size corresponding to the loaded data.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">choose_data_file</span><span class="p">(</span><span class="n">location</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span><span class="p">)</span>
+        
+        <span class="k">if</span> <span class="n">path</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">path</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c">#Load data</span>
+            <span class="kn">from</span> <span class="nn">load_thread</span> <span class="kn">import</span> <span class="n">DataReader</span>
+            <span class="c">## If a thread is already started, stop it</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                                <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Loading...&quot;</span><span class="p">,</span>
+                                <span class="nb">type</span><span class="o">=</span><span class="s">&quot;progress&quot;</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="n">DataReader</span><span class="p">(</span><span class="n">path</span><span class="o">=</span><span class="n">path</span><span class="p">,</span>
+                                    <span class="n">completefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">complete_loading</span><span class="p">,</span>
+                                    <span class="n">updatefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">load_update</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">load_update</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span> 
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Slit Length Calculator: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                          <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&#39;stop&#39;</span><span class="p">))</span>
+            <span class="k">return</span> 
+        </div>
+<div class="viewcode-block" id="SlitLengthCalculatorPanel.load_update"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.slit_length_calculator_panel.SlitLengthCalculatorPanel.load_update">[docs]</a>    <span class="k">def</span> <span class="nf">load_update</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        print update on the status bar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span> 
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+            <span class="nb">type</span> <span class="o">=</span> <span class="s">&quot;progress&quot;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="nb">type</span> <span class="o">=</span> <span class="s">&quot;stop&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;&quot;</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="nb">type</span><span class="p">))</span>
+            </div>
+<div class="viewcode-block" id="SlitLengthCalculatorPanel.complete_loading"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.slit_length_calculator_panel.SlitLengthCalculatorPanel.complete_loading">[docs]</a>    <span class="k">def</span> <span class="nf">complete_loading</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Complete the loading and compute the slit size</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;Data2D&#39;</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span> 
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Slit Length cannot be computed for 2D Data&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&#39;stop&#39;</span><span class="p">))</span>
+            <span class="k">return</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">filename</span><span class="p">))</span>
+        <span class="c">#compute the slit size</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">x</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">x</span>
+            <span class="n">y</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">y</span>
+            <span class="k">if</span> <span class="n">x</span> <span class="o">==</span> <span class="p">[]</span> <span class="ow">or</span>  <span class="n">x</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">y</span> <span class="o">==</span> <span class="p">[]</span> <span class="ow">or</span> <span class="n">y</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;The current data is empty please check x and y&quot;</span>
+                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">msg</span>
+            <span class="n">slit_length_calculator</span> <span class="o">=</span> <span class="n">SlitlengthCalculator</span><span class="p">()</span>
+            <span class="n">slit_length_calculator</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="n">y</span><span class="p">)</span>
+            <span class="n">slit_length</span> <span class="o">=</span> <span class="n">slit_length_calculator</span><span class="o">.</span><span class="n">calculate_slit_length</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span> 
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Slit Size Calculator: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                          <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&#39;stop&#39;</span><span class="p">))</span>
+            <span class="k">return</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">slit_length</span><span class="p">))</span>
+        <span class="c">#Display unit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_size_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;[Unknown]&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Load Complete&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&#39;stop&#39;</span><span class="p">))</span>
+    
+    </div></div>
+<div class="viewcode-block" id="SlitLengthCalculatorWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.slit_length_calculator_panel.SlitLengthCalculatorWindow">[docs]</a><span class="k">class</span> <span class="nc">SlitLengthCalculatorWindow</span><span class="p">(</span><span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Slit Size Calculator&quot;</span><span class="p">,</span>
+                <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span><span class="n">PANEL_HEIGHT</span><span class="p">),</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span><span class="o">=</span> <span class="n">size</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">]</span><span class="o">=</span> <span class="n">title</span>
+        <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">SlitLengthCalculatorPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</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_CLOSE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetPosition</span><span class="p">((</span><span class="mi">25</span><span class="p">,</span> <span class="mi">150</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+<div class="viewcode-block" id="SlitLengthCalculatorWindow.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.slit_length_calculator_panel.SlitLengthCalculatorWindow.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Close event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">cal_slit_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        </div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">app</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">PySimpleApp</span><span class="p">()</span>
+    <span class="n">widget</span><span class="o">.</span><span class="n">CHILD_FRAME</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span>
+    <span class="n">frame</span> <span class="o">=</span> <span class="n">SlitLengthCalculatorWindow</span><span class="p">()</span>    
+    <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>     
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/calculator/source_editor.html
===================================================================
--- _modules/sas/perspectives/calculator/source_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/calculator/source_editor.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,636 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.calculator.source_editor &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.calculator" href="../calculator.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" accesskey="U">sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.calculator.source_editor</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">deepcopy</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">check_float</span>
+
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">60</span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">450</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">430</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">480</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">550</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">430</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    
+<div class="viewcode-block" id="SourceDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog">[docs]</a><span class="k">class</span> <span class="nc">SourceDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Source Editor&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span> <span class="o">=</span> <span class="n">source</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">source</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_description</span> <span class="o">=</span> <span class="s">&quot;Edit source&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+   
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            define initial sizer </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">box_source</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="s">&quot;source&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">box_source</span><span class="p">,</span>
+                                                    <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">radiation_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_shape_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_min_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_max_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_size_name_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_size_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+       
+    <span class="k">def</span> <span class="nf">_layout_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for sample name related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Sample name [string]</span>
+        <span class="n">sample_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Sample Name : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_name_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">5</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">sample_name_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sample_name_tcl</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">EXPAND</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_layout_radiation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for  radiation related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Radiation type [string]</span>
+        <span class="n">radiation_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Radiation: &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">radiation_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">radiation_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">radiation_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">radiation_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_beam_shape</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for beam shape related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Beam shape [string]</span>
+        <span class="n">beam_shape_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Beam shape:&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_shape_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_shape_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">beam_shape_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">beam_shape_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_wavelength</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for wavelength related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Wavelength [float] [Angstrom]</span>
+        <span class="n">wavelength_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;wavelength:&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>   
+        <span class="n">wavelength_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span><span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">wavelength_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">12</span><span class="p">),</span>
+                            <span class="p">(</span><span class="n">wavelength_unit_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_unit_tcl</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">EXPAND</span><span class="p">)])</span> 
+        
+    <span class="k">def</span> <span class="nf">_layout_wavelength_min</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for wavelength min related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Minimum wavelength [float] [Angstrom]</span>
+        <span class="n">wavelength_min_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Wavelength min:&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_min_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                               <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>   
+        <span class="n">wavelength_min_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_min_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_min_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">wavelength_min_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_min_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                            <span class="p">(</span><span class="n">wavelength_min_unit_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_min_unit_tcl</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">EXPAND</span><span class="p">)])</span>  
+    
+    <span class="k">def</span> <span class="nf">_layout_wavelength_max</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for wavelength max related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Maximum wavelength [float] [Angstrom]</span>
+        <span class="n">wavelength_max_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Wavelength max:&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_max_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>   
+        <span class="n">wavelength_max_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_max_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_max_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">wavelength_max_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_max_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">7</span><span class="p">),</span>
+                            <span class="p">(</span><span class="n">wavelength_max_unit_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_max_unit_tcl</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">EXPAND</span><span class="p">)])</span> 
+    
+    <span class="k">def</span> <span class="nf">_layout_wavelength_spread</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for wavelength spread related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Wavelength spread [float] [Angstrom]</span>
+        <span class="n">wavelength_spread</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">wavelength_spread_unit</span> <span class="o">=</span> <span class="s">&#39;percent&#39;</span>
+        <span class="n">wavelength_spread_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Wavelength spread:&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>   
+        <span class="n">wavelength_spread_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">wavelength_spread_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                        <span class="p">(</span><span class="n">wavelength_spread_unit_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_unit_tcl</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">EXPAND</span><span class="p">)])</span> 
+    <span class="k">def</span> <span class="nf">_layout_beam_size_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for beam size name related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Beam size name [string]</span>
+        <span class="n">beam_size_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Beam size name : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_size_name_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                               <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">5</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_size_name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">beam_size_name_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">beam_size_name_tcl</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">EXPAND</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_beam_size</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the  layout for beam size related widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Beam size [Vector] [mm]</span>
+        <span class="n">beam_size</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">beam_size_unit</span> <span class="o">=</span> <span class="s">&#39;mm&#39;</span>
+       
+        <span class="n">beam_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Beam size:&#39;</span><span class="p">)</span> 
+        <span class="n">x_beam_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;x = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_beam_size_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">y_beam_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;y = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_beam_size_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="n">z_beam_size_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;z = &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_beam_size_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="n">beam_size_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Unit: &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_size_unit_tcl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_size_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">beam_size_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">x_beam_size_txt</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">LEFT</span><span class="p">,</span> <span class="mi">17</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_beam_size_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">y_beam_size_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_beam_size_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">z_beam_size_txt</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">EXPAND</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_beam_size_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="n">beam_size_unit_txt</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">EXPAND</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">beam_size_unit_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;Apply&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_apply</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Apply current changes to the source.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&#39;Cancel&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Cancel current changes.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_click_cancel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span><span class="s">&#39;Close&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bt_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close window.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_apply</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">LEFT</span><span class="p">,</span> <span class="mi">200</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_cancel</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bt_close</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">             Draw the current panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_radiation</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_beam_shape</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_wavelength</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_wavelength_min</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_wavelength_max</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_wavelength_spread</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_beam_size_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_beam_size</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+     
+        <span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">radiation_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">beam_shape_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_min_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_max_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">beam_size_name_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">beam_size_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">boxsizer_source</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="SourceDialog.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.set_manager">[docs]</a>    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;    </span>
+<span class="sd">            Set manager of this window</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        </div>
+<div class="viewcode-block" id="SourceDialog.reset_source"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.reset_source">[docs]</a>    <span class="k">def</span> <span class="nf">reset_source</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            put back initial values of the source</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">radiation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">radiation</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">beam_size_name</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span>  <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span>  <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">y</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span>  <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">z</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size_unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">beam_size_unit</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_shape</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">beam_shape</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">wavelength</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">wavelength_unit</span>
+        <span class="c">## Minimum wavelength [float] [Angstrom]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">wavelength_min</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_min_unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">wavelength_min_unit</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">wavelength_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_max_unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">wavelength_max_unit</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_spread</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">wavelength_spread</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_spread_unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_reset_source</span><span class="o">.</span><span class="n">wavelength_spread_unit</span>
+       </div>
+<div class="viewcode-block" id="SourceDialog.set_values"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.set_values">[docs]</a>    <span class="k">def</span> <span class="nf">set_values</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            take the source values of the current data and display them</span>
+<span class="sd">            through the panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">source</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span>
+        <span class="c">#Name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sample_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+        <span class="c">#Radiation</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">radiation_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">radiation</span><span class="p">))</span>
+        <span class="c">#Beam shape </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_shape_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">beam_shape</span><span class="p">))</span>
+        <span class="c">#Wavelength</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_unit</span><span class="p">))</span>
+        <span class="c">#Wavelength min</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_min_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_min</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_min_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_min_unit</span><span class="p">))</span>
+        <span class="c">#Wavelength max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_max_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_max</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_max_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_max_unit</span><span class="p">))</span>
+        <span class="c">#Wavelength spread</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_spread</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_spread_unit</span><span class="p">))</span>
+        <span class="c">#Beam size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_size_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">beam_size_name</span><span class="p">))</span>
+        <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">y</span> <span class="p">,</span> <span class="n">source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">z</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">x_beam_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">y_beam_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">y</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">z_beam_size_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">beam_size_unit_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">beam_size_unit</span><span class="p">))</span>
+    </div>
+<div class="viewcode-block" id="SourceDialog.get_source"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.get_source">[docs]</a>    <span class="k">def</span> <span class="nf">get_source</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            return the current source</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span>
+    </div>
+<div class="viewcode-block" id="SourceDialog.get_notes"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.get_notes">[docs]</a>    <span class="k">def</span> <span class="nf">get_notes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            return notes</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span>
+    </div>
+<div class="viewcode-block" id="SourceDialog.on_change_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.on_change_name">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change the name of the source</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sample_name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">name</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">name</span> <span class="o">!=</span> <span class="n">name</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change sample &#39;s &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;name from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+            </div>
+<div class="viewcode-block" id="SourceDialog.on_change_radiation"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.on_change_radiation">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_radiation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change radiation of the sample </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change radiation</span>
+        <span class="n">radiation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">radiation_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">radiation</span> <span class="o">=</span> <span class="n">radiation</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change radiation from&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">radiation</span><span class="p">,</span> <span class="n">radiation</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="SourceDialog.on_change_beam_shape"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.on_change_beam_shape">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_beam_shape</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change beams shape</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+       <span class="c">#Change beam shape </span>
+        <span class="n">beam_shape</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">beam_shape_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_shape</span> <span class="o">=</span> <span class="n">beam_shape</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change beam shape from&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_shape</span><span class="p">,</span> <span class="n">beam_shape</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="SourceDialog.on_change_wavelength"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.on_change_wavelength">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_wavelength</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change the wavelength</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change wavelength  </span>
+        <span class="n">wavelength</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength</span> <span class="o">=</span> <span class="n">wavelength</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change wavelength from&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength</span><span class="p">,</span> <span class="n">wavelength</span><span class="p">)</span>
+        <span class="c">#change the wavelength  unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change wavelength&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="SourceDialog.on_change_wavelength_min"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.on_change_wavelength_min">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_wavelength_min</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change the wavelength minimum</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change wavelength min</span>
+        <span class="n">wavelength_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_min_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_min</span> <span class="o">=</span> <span class="n">wavelength_min</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change wavelength  min from&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_min</span><span class="p">,</span>
+                                          <span class="n">wavelength_min</span><span class="p">)</span>
+        <span class="c">#change the wavelength min unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_min_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_min_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change wavelength min&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_min_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="SourceDialog.on_change_wavelength_max"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.on_change_wavelength_max">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_wavelength_max</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change the wavelength maximum</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change wavelength max</span>
+        <span class="n">wavelength_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_max_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_max</span> <span class="o">=</span> <span class="n">wavelength_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change wavelength  max from&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_max</span><span class="p">,</span>
+                                        <span class="n">wavelength_max</span><span class="p">)</span>
+        <span class="c">#change the wavelength max unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_max_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_max_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change wavelength max&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_max_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="SourceDialog.on_change_wavelength_spread"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.on_change_wavelength_spread">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_wavelength_spread</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change the wavelength spread</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change wavelength spread</span>
+        <span class="n">wavelength_spread</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change wavelength  spread from&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_spread</span><span class="p">,</span> 
+                                         <span class="n">wavelength_spread</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_spread</span> <span class="o">=</span> <span class="n">wavelength_spread</span>
+        <span class="c">#change the wavelength spread unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wavelength_spread_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_spread_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change wavelength spread&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_spread_unit</span><span class="p">,</span> 
+                                         <span class="n">unit</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">wavelength_spread_unit</span> <span class="o">=</span> <span class="n">unit</span>
+    </div>
+<div class="viewcode-block" id="SourceDialog.on_change_beam_size_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.on_change_beam_size_name">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_beam_size_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change beam size name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change beam size name</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">beam_size_name_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">name</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size_name</span> <span class="o">!=</span> <span class="n">name</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change beam size  &#39;s &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;name from </span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size_name</span><span class="p">,</span>
+                                                       <span class="n">name</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+            </div>
+<div class="viewcode-block" id="SourceDialog.on_change_beam_size"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.on_change_beam_size">[docs]</a>    <span class="k">def</span> <span class="nf">on_change_beam_size</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Change beam size</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Change x coordinate</span>
+        <span class="n">x_beam_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">x_beam_size_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">x_beam_size</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">x_beam_size</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">x_beam_size</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x_beam_size_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">x</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_beam_size</span><span class="p">)</span> <span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change x of beam size from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                                     <span class="n">x_beam_size</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">x</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">x_beam_size</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the beam size &#39;s x &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes x beam size from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                            <span class="n">x_beam_size</span><span class="p">)</span>
+        <span class="c">#Change y coordinate</span>
+        <span class="n">y_beam_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">y_beam_size_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">y_beam_size</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">y_beam_size</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">y_beam_size</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">y_beam_size</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">y_beam_size_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">y</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_beam_size</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change y of beam size from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                                     <span class="n">y_beam_size</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">y</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">y_beam_size</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the beam size&#39;s y &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes y beam size from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                              <span class="n">y_beam_size</span><span class="p">)</span>
+        <span class="c">#Change z coordinate</span>
+        <span class="n">z_beam_size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">z_beam_size_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">z_beam_size</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">z_beam_size</span> <span class="o">==</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">):</span>
+            <span class="n">z_beam_size</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">z</span> <span class="o">=</span> <span class="n">z_beam_size</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">z_beam_size_tcl</span><span class="p">):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">z</span> <span class="o">!=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_beam_size</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Change z of beam size from &quot;</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                                     <span class="n">z_beam_size</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">z</span>  <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">z_beam_size</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;Error: Expected a float for the beam size &#39;s z &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;won&#39;t changes z beam size from &quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                              <span class="n">z_beam_size</span><span class="p">)</span>
+        <span class="c">#change the beam center unit</span>
+        <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">beam_size_unit_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size_unit</span> <span class="o">!=</span> <span class="n">unit</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot; Change beam size&#39;s unit from &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> to </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size_unit</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">beam_size_unit</span> <span class="o">=</span> <span class="n">unit</span>
+                 </div>
+<div class="viewcode-block" id="SourceDialog.on_click_apply"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.on_click_apply">[docs]</a>    <span class="k">def</span> <span class="nf">on_click_apply</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Apply user values to the source</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_radiation</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_beam_shape</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_wavelength</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_wavelength_min</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_wavelength_max</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_wavelength_spread</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_beam_size_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_change_beam_size</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">set_source</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_notes</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="SourceDialog.on_click_cancel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.calculator.html#sas.perspectives.calculator.source_editor.SourceDialog.on_click_cancel">[docs]</a>    <span class="k">def</span> <span class="nf">on_click_cancel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        reset the current source</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_source</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">set_source</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+    </div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span><span class="s">&quot;__main__&quot;</span><span class="p">:</span>
+    <span class="n">app</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">()</span>
+    <span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Source</span>
+    <span class="n">source</span> <span class="o">=</span> <span class="n">Source</span><span class="p">()</span>
+    <span class="n">dlg</span> <span class="o">=</span> <span class="n">SourceDialog</span><span class="p">(</span><span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">)</span>
+    <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>
+ 
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../calculator.html" >sas.perspectives.calculator</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting.html
===================================================================
--- _modules/sas/perspectives/fitting.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,141 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../index.html" />
+    <link rel="up" title="Module code" href="../../index.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../index.html" accesskey="U">Module code</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting</h1><div class="highlight"><pre>
+<span class="n">PLUGIN_ID</span> <span class="o">=</span> <span class="s">&quot;Fitting plug-in 1.0&quot;</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">from</span> <span class="nn">fitting</span> <span class="kn">import</span> <span class="o">*</span>
+<span class="kn">from</span> <span class="nn">distutils.filelist</span> <span class="kn">import</span> <span class="n">findall</span>
+<div class="viewcode-block" id="get_data_path"><a class="viewcode-back" href="../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.get_data_path">[docs]</a><span class="k">def</span> <span class="nf">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c"># Check for data path in the package</span>
+    <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">),</span> <span class="n">media</span><span class="p">)</span>
+    <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+        <span class="k">return</span> <span class="n">path</span>
+
+    <span class="c"># Check for data path next to exe/zip file.</span>
+    <span class="c"># If we are inside a py2exe zip file, we need to go up</span>
+    <span class="c"># to get to the directory containing </span>
+    <span class="c"># the media for this module</span>
+    <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">)</span>
+    <span class="c">#Look for maximum n_dir up of the current dir to find media</span>
+    <span class="n">n_dir</span> <span class="o">=</span> <span class="mi">12</span>
+    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">n_dir</span><span class="p">):</span>
+        <span class="n">path</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">media_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">media</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">media_path</span><span class="p">):</span>
+            <span class="n">module_media_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">media_path</span><span class="p">,</span> <span class="s">&#39;fitting_media&#39;</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">module_media_path</span><span class="p">):</span>
+                <span class="k">return</span> <span class="n">module_media_path</span>
+            <span class="k">return</span> <span class="n">media_path</span>
+   
+    <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&#39;Could not find models media files&#39;</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="data_files"><a class="viewcode-back" href="../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.data_files">[docs]</a><span class="k">def</span> <span class="nf">data_files</span><span class="p">():</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Return the data files associated with media.</span>
+<span class="sd">    </span>
+<span class="sd">    The format is a list of (directory, [files...]) pairs which can be</span>
+<span class="sd">    used directly in setup(...,data_files=...) for setup.py.</span>
+
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">data_files</span> <span class="o">=</span> <span class="p">[]</span>
+    <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">)</span>
+    <span class="n">p_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="s">&#39;plugin_models&#39;</span><span class="p">)</span>
+    <span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">findall</span><span class="p">(</span><span class="n">p_path</span><span class="p">):</span>
+        <span class="n">data_files</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">&#39;plugin_models&#39;</span><span class="p">,</span> <span class="p">[</span><span class="n">f</span><span class="p">]))</span>
+    <span class="n">path</span> <span class="o">=</span> <span class="n">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&quot;media&quot;</span><span class="p">)</span>
+    <span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">findall</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+        <span class="n">data_files</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">&#39;media/fitting_media&#39;</span><span class="p">,</span> <span class="p">[</span><span class="n">f</span><span class="p">]))</span>
+    
+    <span class="k">return</span> <span class="n">data_files</span></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../index.html" >Module code</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/basepage.html
===================================================================
--- _modules/sas/perspectives/fitting/basepage.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/basepage.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,3978 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.basepage &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.basepage</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Base Page for fitting</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">numpy</span>
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">import</span> <span class="nn">copy</span>
+<span class="kn">import</span> <span class="nn">math</span>
+<span class="kn">import</span> <span class="nn">string</span>
+<span class="kn">import</span> <span class="nn">json</span>
+<span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">defaultdict</span>
+<span class="kn">from</span> <span class="nn">wx.lib.scrolledpanel</span> <span class="kn">import</span> <span class="n">ScrolledPanel</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">format_number</span><span class="p">,</span> <span class="n">check_float</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">PanelOnFocusEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">AppendBookmarkEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">Data2D</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">Data1D</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">check_data_validity</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.gui_style</span> <span class="kn">import</span> <span class="n">GUIFRAME_ID</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Detector</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Source</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.pagestate</span> <span class="kn">import</span> <span class="n">PageState</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.CategoryInstaller</span> <span class="kn">import</span> <span class="n">CategoryInstaller</span>
+
+<span class="p">(</span><span class="n">PageInfoEvent</span><span class="p">,</span> <span class="n">EVT_PAGE_INFO</span><span class="p">)</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">newevent</span><span class="o">.</span><span class="n">NewEvent</span><span class="p">()</span>
+<span class="p">(</span><span class="n">PreviousStateEvent</span><span class="p">,</span> <span class="n">EVT_PREVIOUS_STATE</span><span class="p">)</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">newevent</span><span class="o">.</span><span class="n">NewEvent</span><span class="p">()</span>
+<span class="p">(</span><span class="n">NextStateEvent</span><span class="p">,</span> <span class="n">EVT_NEXT_STATE</span><span class="p">)</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">newevent</span><span class="o">.</span><span class="n">NewEvent</span><span class="p">()</span>
+
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">76</span>
+<span class="n">_QMIN_DEFAULT</span> <span class="o">=</span> <span class="mf">0.0005</span>
+<span class="n">_QMAX_DEFAULT</span> <span class="o">=</span> <span class="mf">0.5</span>
+<span class="n">_NPTS_DEFAULT</span> <span class="o">=</span> <span class="mi">50</span>
+<span class="c">#Control panel width</span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">450</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+    <span class="n">ON_MAC</span> <span class="o">=</span> <span class="bp">False</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    <span class="n">ON_MAC</span> <span class="o">=</span> <span class="bp">True</span>
+
+
+<div class="viewcode-block" id="BasicPage"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage">[docs]</a><span class="k">class</span> <span class="nc">BasicPage</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    This class provide general structure of  fitpanel page</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal name for the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;Fit Page&quot;</span>
+    <span class="c">## Title to appear on top of the window</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;Fit Page &quot;</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">&#39;blue&#39;</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        <span class="c">#Set window&#39;s font size</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+      
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">color</span><span class="p">)</span>
+        <span class="c">## parent of the page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="c">## manager is the fitting plugin</span>
+        <span class="c">## owner of the page (fitting plugin)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">event_owner</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## current model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">m_name</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">index_model</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#list of available data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mask</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">uid</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#Q range for data set</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_data_set</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">inf</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_data_set</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_data_set</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">## Q range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="n">_QMAX_DEFAULT</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="n">_QMIN_DEFAULT</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span> <span class="o">=</span> <span class="n">_NPTS_DEFAULT</span>
+        <span class="c">## total number of point: float</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">num_points</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## default fitengine type</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">engine_type</span> <span class="o">=</span> <span class="s">&#39;bumps&#39;</span>
+        <span class="c">## smear default</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## 2D smear accuracy default</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear2d_accuracy</span> <span class="o">=</span> <span class="s">&#39;Low&#39;</span>
+        <span class="c">## slit smear:</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## pinhole smear</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">##semar attrbs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">##weigth attrbs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">##other attrbs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dq_l</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dq_r</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_box</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_disp</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">theory_qmin</span> <span class="o">=</span> <span class="bp">None</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">theory_qmax</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">theory_qmin_x</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">theory_qmax_x</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sld_axes</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span> <span class="o">=</span> <span class="bp">None</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span> <span class="o">=</span> <span class="p">{}</span>
+   
+        <span class="c">#self.state = PageState(parent=parent)</span>
+        <span class="c">## dictionary containing list of models</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="p">{}</span>
+       
+        <span class="c">## Data member to store the dispersion object created</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c">## selected parameters to apply dispersion</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c">## smearer object</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_has_magnetic</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span> <span class="o">=</span> <span class="n">ON_MAC</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">##list of model parameters. each item must have same length</span>
+        <span class="c">## each item related to a given parameters</span>
+        <span class="c">##[cb state, name, value, &quot;+/-&quot;, error of fit, min, max , units]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># non-fittable parameter whose value is astring</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## list of parameters to fit , must be like self.parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## list of looking like parameters but with non fittable parameters info</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## list of looking like parameters but with  fittable parameters info</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">##list of dispersion parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        
+        <span class="c">## list of orientation parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span> <span class="o">=</span> <span class="p">[]</span>
+<span class="c">#       Self.model should ALWAYS be None here.  It was set to none above in </span>
+<span class="c">#       this long init setting.  no obvious function call in between setting</span>
+<span class="c">#       and this - commenting out on 4/8/2014 by PDB.  Remove once clear </span>
+<span class="c">#       it is pointless.</span>
+<span class="c">#        if self.model != None:</span>
+<span class="c">#            self.disp_list = self.model.getDispParamList()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">temp_multi_functional</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">##enable model 2D draw</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">## check that the fit range is correct to plot the model again</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c">## Create memento to save the current state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="n">PageState</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                               <span class="n">model</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        <span class="c">## flag to determine if state has change</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_change</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">## save customized array</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">values</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weights</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## retrieve saved state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">number_saved_state</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">## dictionary of saved state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">saved_states</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c">## Create context menu for page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+    
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_keep</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MenuItem</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Add bookmark&quot;</span><span class="p">,</span>
+                                 <span class="s">&quot; Keep the panel status to recall it later&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="o">.</span><span class="n">AppendItem</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_keep</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_keep</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">False</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_bookmark</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="o">.</span><span class="n">AppendSeparator</span><span class="p">()</span>
+    
+        <span class="c">## Default locations</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>
+        <span class="c">## save initial state on context menu</span>
+        <span class="c">#self.onSave(event=None)</span>
+        <span class="bp">self</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_CONTEXT_MENU</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onContextMenu</span><span class="p">)</span>
+        
+        <span class="c"># bind key event</span>
+        <span class="bp">self</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_LEFT_DOWN</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_left_down</span><span class="p">)</span>
+        
+        <span class="c">## create the basic structure of the panel with empty sizer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">define_page_structure</span><span class="p">()</span>
+        <span class="c">## drawing Initial dispersion parameters sizer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_dispers_sizer</span><span class="p">()</span>
+        
+        <span class="c">## layout</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_layout</span><span class="p">()</span>
+    
+<div class="viewcode-block" id="BasicPage.set_index_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.set_index_model">[docs]</a>    <span class="k">def</span> <span class="nf">set_index_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">index</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Index related to this page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">index_model</span> <span class="o">=</span> <span class="n">index</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.create_default_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.create_default_data">[docs]</a>    <span class="k">def</span> <span class="nf">create_default_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Given the user selection, creates a 1D or 2D data</span>
+<span class="sd">        Only when the page is on theory mode.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;model_view&quot;</span><span class="p">):</span>
+            <span class="k">return</span>
+        <span class="n">toggle_mode_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">toggle_mode_on</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">check_data_validity</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">):</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_create_default_2d_data</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pointsbox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_create_log_1d_data</span><span class="p">()</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_create_default_1d_data</span><span class="p">()</span>
+                        
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_fit_data</span><span class="p">(</span><span class="n">data</span><span class="o">=</span>\
+                                                                <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">])</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">on_smear_helper</span><span class="p">(</span><span class="n">update</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disable_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">pinhole_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">slit_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_create_default_1d_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create default data for fitting perspective</span>
+<span class="sd">        Only when the page is on theory mode.</span>
+<span class="sd">        :warning: This data is never plotted.</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">x</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">start</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">,</span> <span class="n">stop</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">,</span>
+                           <span class="n">num</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Q}&#39;</span><span class="p">,</span> <span class="s">&quot;A^{-1}&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Intensity}&#39;</span><span class="p">,</span> <span class="s">&quot;cm^{-1}&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; data&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model1D&quot;</span>
+         
+    <span class="k">def</span> <span class="nf">_create_log_1d_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create log-spaced data for fitting perspective</span>
+<span class="sd">        Only when the page is on theory mode.</span>
+<span class="sd">        :warning: This data is never plotted.</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">&gt;=</span> <span class="mf">1.e-10</span><span class="p">:</span>
+            <span class="n">qmin</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">qmin</span> <span class="o">=</span> <span class="o">-</span><span class="mf">10.</span>    
+            
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">&lt;=</span> <span class="mf">1.e10</span><span class="p">:</span>
+            <span class="n">qmax</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">log10</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">qmax</span> <span class="o">=</span> <span class="mf">10.</span> 
+               
+        <span class="n">x</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">logspace</span><span class="p">(</span><span class="n">start</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span> <span class="n">stop</span><span class="o">=</span><span class="n">qmax</span><span class="p">,</span>
+                           <span class="n">num</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="mf">10.0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Q}&#39;</span><span class="p">,</span> <span class="s">&quot;A^{-1}&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Intensity}&#39;</span><span class="p">,</span> <span class="s">&quot;cm^{-1}&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; data&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model1D&quot;</span>
+      
+    <span class="k">def</span> <span class="nf">_create_default_2d_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create 2D data by default</span>
+<span class="sd">        Only when the page is on theory mode.</span>
+<span class="sd">        :warning: This data is never plotted.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">Data2D</span><span class="p">()</span>
+        <span class="n">qmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">/</span> <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Q_{x}}&#39;</span><span class="p">,</span> <span class="s">&#39;A^{-1}&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Q_{y}}&#39;</span><span class="p">,</span> <span class="s">&#39;A^{-1}&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; data&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model2D&quot;</span>
+        <span class="c">## Default values</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Detector</span><span class="p">())</span>
+        <span class="n">index</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">distance</span> <span class="o">=</span> <span class="mi">8000</span>   <span class="c"># mm</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength</span> <span class="o">=</span> <span class="mi">6</span>             <span class="c"># A</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="mi">5</span>  <span class="c"># mm</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="mi">5</span>  <span class="c"># mm</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">detector</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="c">## create x_bins and y_bins of the model 2D</span>
+        <span class="c">#pixel_width_x = self.data.detector[index].pixel_size.x</span>
+        <span class="c">#pixel_width_y = self.data.detector[index].pixel_size.y</span>
+        <span class="c">#center_x = self.data.detector[index].beam_center.x/pixel_width_x</span>
+        <span class="c">#center_y = self.data.detector[index].beam_center.y/pixel_width_y</span>
+        <span class="c"># theory default: assume the beam</span>
+        <span class="c">#center is located at the center of sqr detector</span>
+        <span class="n">xmax</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="n">xmin</span> <span class="o">=</span> <span class="o">-</span><span class="n">qmax</span>
+        <span class="n">ymax</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="n">ymin</span> <span class="o">=</span> <span class="o">-</span><span class="n">qmax</span>
+        <span class="n">qstep</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span>
+
+        <span class="n">x</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">start</span><span class="o">=</span><span class="n">xmin</span><span class="p">,</span> <span class="n">stop</span><span class="o">=</span><span class="n">xmax</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="n">qstep</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+        <span class="n">y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="n">start</span><span class="o">=</span><span class="n">ymin</span><span class="p">,</span> <span class="n">stop</span><span class="o">=</span><span class="n">ymax</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="n">qstep</span><span class="p">,</span> <span class="n">endpoint</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+        <span class="c">## use data info instead</span>
+        <span class="n">new_x</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">tile</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">),</span> <span class="mi">1</span><span class="p">))</span>
+        <span class="n">new_y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">tile</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="mi">1</span><span class="p">))</span>
+        <span class="n">new_y</span> <span class="o">=</span> <span class="n">new_y</span><span class="o">.</span><span class="n">swapaxes</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
+        <span class="c"># all data reuire now in 1d array</span>
+        <span class="n">qx_data</span> <span class="o">=</span> <span class="n">new_x</span><span class="o">.</span><span class="n">flatten</span><span class="p">()</span>
+        <span class="n">qy_data</span> <span class="o">=</span> <span class="n">new_y</span><span class="o">.</span><span class="n">flatten</span><span class="p">()</span>
+        <span class="n">q_data</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">qx_data</span> <span class="o">*</span> <span class="n">qx_data</span> <span class="o">+</span> <span class="n">qy_data</span> <span class="o">*</span> <span class="n">qy_data</span><span class="p">)</span>
+        <span class="c"># set all True (standing for unmasked) as default</span>
+        <span class="n">mask</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">qx_data</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span>
+        <span class="c"># calculate the range of qx and qy: this way,</span>
+        <span class="c"># it is a little more independent</span>
+        <span class="c">#x_size = xmax - xmin</span>
+        <span class="c">#y_size = ymax - ymin</span>
+        <span class="c"># store x and y bin centers in q space</span>
+        <span class="n">x_bins</span> <span class="o">=</span> <span class="n">x</span>
+        <span class="n">y_bins</span> <span class="o">=</span> <span class="n">y</span>
+        <span class="c"># bin size: x- &amp; y-directions</span>
+        <span class="c">#xstep = x_size / len(x_bins - 1)</span>
+        <span class="c">#ystep = y_size / len(y_bins - 1)</span>
+  
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">Source</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">mask</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">err_data</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">mask</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">=</span> <span class="n">qx_data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qy_data</span> <span class="o">=</span> <span class="n">qy_data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">q_data</span> <span class="o">=</span> <span class="n">q_data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">mask</span> <span class="o">=</span> <span class="n">mask</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x_bins</span> <span class="o">=</span> <span class="n">x_bins</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">y_bins</span> <span class="o">=</span> <span class="n">y_bins</span>
+        <span class="c"># max and min taking account of the bin sizes</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xmin</span> <span class="o">=</span> <span class="n">xmin</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xmax</span> <span class="o">=</span> <span class="n">xmax</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">ymin</span> <span class="o">=</span> <span class="n">ymin</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">ymax</span> <span class="o">=</span> <span class="n">ymax</span>
+
+<div class="viewcode-block" id="BasicPage.on_set_focus"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_set_focus">[docs]</a>    <span class="k">def</span> <span class="nf">on_set_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Set Focus, update guimanger and menu</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">PanelOnFocusEvent</span><span class="p">(</span><span class="n">panel</span><span class="o">=</span><span class="bp">self</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">on_tap_focus</span><span class="p">()</span>
+               </div>
+<div class="viewcode-block" id="BasicPage.on_tap_focus"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_tap_focus">[docs]</a>    <span class="k">def</span> <span class="nf">on_tap_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Update menu1 on cliking the page tap</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">menu1</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">chain_menu</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span>\
+                                                   <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">id_reset_flag</span><span class="p">)</span>
+            <span class="n">chain_menu</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">)</span>
+            <span class="n">sim_menu</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">id_simfit</span><span class="p">)</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span>\
+                            <span class="ow">and</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">)</span>
+            <span class="n">sim_menu</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span> <span class="ow">and</span> <span class="n">flag</span><span class="p">)</span>
+            <span class="n">batch_menu</span> <span class="o">=</span> \
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">id_batchfit</span><span class="p">)</span>
+            <span class="n">batch_menu</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span> <span class="ow">and</span> <span class="n">flag</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.ModelTextCtrl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.ModelTextCtrl">[docs]</a>    <span class="k">class</span> <span class="nc">ModelTextCtrl</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Text control for model and fit parameters.</span>
+<span class="sd">        Binds the appropriate events for user interactions.</span>
+<span class="sd">        Default callback methods can be overwritten on initialization</span>
+<span class="sd">        </span>
+<span class="sd">        :param kill_focus_callback: callback method for EVT_KILL_FOCUS event</span>
+<span class="sd">        :param set_focus_callback:  callback method for EVT_SET_FOCUS event</span>
+<span class="sd">        :param mouse_up_callback:   callback method for EVT_LEFT_UP event</span>
+<span class="sd">        :param text_enter_callback: callback method for EVT_TEXT_ENTER event</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Set to True when the mouse is clicked while whole string is selected</span>
+        <span class="n">full_selection</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">## Call back for EVT_SET_FOCUS events</span>
+        <span class="n">_on_set_focus_callback</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span>
+                     <span class="n">value</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">EmptyString</span><span class="p">,</span>
+                     <span class="n">pos</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">DefaultPosition</span><span class="p">,</span>
+                     <span class="n">size</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">DefaultSize</span><span class="p">,</span>
+                     <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
+                     <span class="n">validator</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">DefaultValidator</span><span class="p">,</span>
+                     <span class="n">name</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TextCtrlNameStr</span><span class="p">,</span>
+                     <span class="n">kill_focus_callback</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                     <span class="n">set_focus_callback</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                     <span class="n">mouse_up_callback</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                     <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+             
+            <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">pos</span><span class="p">,</span>
+                                  <span class="n">size</span><span class="p">,</span> <span class="n">style</span><span class="p">,</span> <span class="n">validator</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+            
+            <span class="c"># Bind appropriate events</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_on_set_focus_callback</span> <span class="o">=</span> <span class="n">parent</span><span class="o">.</span><span class="n">onSetFocus</span> \
+                      <span class="k">if</span> <span class="n">set_focus_callback</span> <span class="ow">is</span> <span class="bp">None</span> <span class="k">else</span> <span class="n">set_focus_callback</span>
+            <span class="bp">self</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_SET_FOCUS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_set_focus</span><span class="p">)</span>
+            <span class="bp">self</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="bp">self</span><span class="o">.</span><span class="n">_silent_kill_focus</span> \
+                      <span class="k">if</span> <span class="n">kill_focus_callback</span> <span class="ow">is</span> <span class="bp">None</span> <span class="k">else</span> <span class="n">kill_focus_callback</span><span class="p">)</span>
+            <span class="bp">self</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">parent</span><span class="o">.</span><span class="n">_onparamEnter</span> \
+                      <span class="k">if</span> <span class="n">text_enter_callback</span> <span class="ow">is</span> <span class="bp">None</span> <span class="k">else</span> <span class="n">text_enter_callback</span><span class="p">)</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">ON_MAC</span><span class="p">:</span>
+                <span class="bp">self</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_LEFT_UP</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_highlight_text</span> \
+                          <span class="k">if</span> <span class="n">mouse_up_callback</span> <span class="ow">is</span> <span class="bp">None</span> <span class="k">else</span> <span class="n">mouse_up_callback</span><span class="p">)</span>
+            
+        <span class="k">def</span> <span class="nf">_on_set_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+            <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Catch when the text control is set in focus to highlight the whole</span>
+<span class="sd">            text if necessary</span>
+<span class="sd">            </span>
+<span class="sd">            :param event: mouse event</span>
+<span class="sd">            </span>
+<span class="sd">            &quot;&quot;&quot;</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span> <span class="o">=</span> <span class="bp">True</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_set_focus_callback</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+        
+        <span class="k">def</span> <span class="nf">_highlight_text</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+            <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Highlight text of a TextCtrl only of no text has be selected</span>
+<span class="sd">            </span>
+<span class="sd">            :param event: mouse event</span>
+<span class="sd">            </span>
+<span class="sd">            &quot;&quot;&quot;</span>
+            <span class="c"># Make sure the mouse event is available to other listeners</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            <span class="n">control</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="c"># Check that we have a TextCtrl</span>
+                <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">control</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span>
+                    <span class="c"># Check whether text has been selected,</span>
+                    <span class="c"># if not, select the whole string</span>
+                    <span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> <span class="o">=</span> <span class="n">control</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="n">start</span> <span class="o">==</span> <span class="n">end</span><span class="p">:</span>
+                        <span class="n">control</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+                        
+        <span class="k">def</span> <span class="nf">_silent_kill_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+            <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Save the state of the page</span>
+<span class="sd">            &quot;&quot;&quot;</span>
+            
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            <span class="c">#pass</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.set_page_info"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.set_page_info">[docs]</a>    <span class="k">def</span> <span class="nf">set_page_info</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">page_info</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set some page important information at once</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+<span class="c">#       THIS METHOD/FUNCTION NO LONGE APPEARS TO BE CALLED.  Started up program </span>
+<span class="c">#       and started new fit window and PR and Invariant and a fit in fitting</span>
+<span class="c">#       but never entered this routine which should be an initialization</span>
+<span class="c">#       routine.  Leave for a while but probably something to clean up at </span>
+<span class="c">#       some point?</span>
+<span class="c">#</span>
+<span class="c">#       PDB April 13 2014</span>
+<span class="c">#</span>
+        <span class="c">##window_name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">window_name</span> <span class="o">=</span> <span class="n">page_info</span><span class="o">.</span><span class="n">window_name</span>
+        <span class="c">##window_caption</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">window_caption</span> <span class="o">=</span> <span class="n">page_info</span><span class="o">.</span><span class="n">window_caption</span>
+        <span class="c">## manager is the fitting plugin</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="n">page_info</span><span class="o">.</span><span class="n">manager</span>
+        <span class="c">## owner of the page (fitting plugin)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">event_owner</span> <span class="o">=</span> <span class="n">page_info</span><span class="o">.</span><span class="n">event_owner</span>
+        <span class="c">## current model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">page_info</span><span class="o">.</span><span class="n">model</span>
+        <span class="c">## data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">page_info</span><span class="o">.</span><span class="n">data</span>
+        <span class="c">## dictionary containing list of models</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="n">page_info</span><span class="o">.</span><span class="n">model_list_box</span>
+        <span class="c">## Data member to store the dispersion object created</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">populate_box</span><span class="p">(</span><span class="n">model_dict</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.onContextMenu"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.onContextMenu">[docs]</a>    <span class="k">def</span> <span class="nf">onContextMenu</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Retrieve the state selected state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Skipping the save state functionality for release 0.9.0</span>
+        <span class="c">#return</span>
+    
+        <span class="n">pos</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetPosition</span><span class="p">()</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ScreenToClient</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">PopupMenu</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="p">,</span> <span class="n">pos</span><span class="p">)</span>
+      </div>
+<div class="viewcode-block" id="BasicPage.onUndo"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.onUndo">[docs]</a>    <span class="k">def</span> <span class="nf">onUndo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Cancel the previous action</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span> <span class="o">=</span> <span class="n">PreviousStateEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.onRedo"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.onRedo">[docs]</a>    <span class="k">def</span> <span class="nf">onRedo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Restore the previous action cancelled</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span> <span class="o">=</span> <span class="n">NextStateEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.define_page_structure"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.define_page_structure">[docs]</a>    <span class="k">def</span> <span class="nf">define_page_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create empty sizer for a panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer0</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer1</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer5</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer6</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>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer0</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer1</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer5</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer6</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer4</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer6</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.set_layout"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.set_layout">[docs]</a>    <span class="k">def</span> <span class="nf">set_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        layout</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Fit</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+ </div>
+<div class="viewcode-block" id="BasicPage.set_owner"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.set_owner">[docs]</a>    <span class="k">def</span> <span class="nf">set_owner</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">owner</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set owner of fitpage</span>
+<span class="sd">        </span>
+<span class="sd">        :param owner: the class responsible of plotting</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">event_owner</span> <span class="o">=</span> <span class="n">owner</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">event_owner</span> <span class="o">=</span> <span class="n">owner</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.get_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_state">[docs]</a>    <span class="k">def</span> <span class="nf">get_state</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the current data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.get_data_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_data_list">[docs]</a>    <span class="k">def</span> <span class="nf">get_data_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the current data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_list</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.set_manager">[docs]</a>    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set panel manager</span>
+<span class="sd">        </span>
+<span class="sd">        :param manager: instance of plugin fitting</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.populate_box"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.populate_box">[docs]</a>    <span class="k">def</span> <span class="nf">populate_box</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model_dict</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store list of model</span>
+<span class="sd">        </span>
+<span class="sd">        :param model_dict: dictionary containing list of models</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="n">model_dict</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">initialize_combox</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.set_model_dictionary"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.set_model_dictionary">[docs]</a>    <span class="k">def</span> <span class="nf">set_model_dictionary</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model_dict</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store a dictionary linking model name -&gt; model object</span>
+
+<span class="sd">        :param model_dict: dictionary containing list of models</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dict</span> <span class="o">=</span> <span class="n">model_dict</span>
+</div>
+<div class="viewcode-block" id="BasicPage.initialize_combox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.initialize_combox">[docs]</a>    <span class="k">def</span> <span class="nf">initialize_combox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        put default value in the combobox</span>
+<span class="sd">        &quot;&quot;&quot;</span>  
+        <span class="c">## fill combox box</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="c">## This is obsolete code since form factor box is no longer static.</span>
+        <span class="c">## It is now set dynamically through _show_combox and _show_combos_helper</span>
+        <span class="c">## These are called for first time by formfactor_combo_init</span>
+        <span class="c">## itself called from fitpanel only.  If we find that I&#39;m wrong and</span>
+        <span class="c">## we DO need to initialize somehow here - do it by a call to </span>
+        <span class="c">## formfactor_combo_init </span>
+        <span class="c">## self.formfator_combo_init()</span>
+        <span class="c">## BUT NOT HERE -- make it last line of this </span>
+        <span class="c">## method so that structure box is populated before _show_comboox_helper</span>
+        <span class="c">## is called.  Otherwise wx will complain mightily:-)</span>
+        <span class="c">##</span>
+        <span class="c">## Also change the name to initiatlize_structurebox along with changes</span>
+        <span class="c">## to other combobox methods (_populate_listbox --&gt; _populate_categorybox</span>
+        <span class="c">## etc )</span>
+        <span class="c">##</span>
+        <span class="c">##     PDB 4/26/2014</span>
+<span class="c">#            self._populate_box(self.formfactorbox,</span>
+<span class="c">#                               self.model_list_box[&quot;Shapes&quot;])</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_populate_box</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="p">,</span>
+                                <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">[</span><span class="s">&quot;Structure Factors&quot;</span><span class="p">])</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span><span class="s">&quot;None&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">text2</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">text2</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+             
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">__class__</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">[</span><span class="s">&quot;P(Q)*S(Q)&quot;</span><span class="p">]:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Show</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">text2</span><span class="o">.</span><span class="n">Show</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">text2</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+
+                </div>
+<div class="viewcode-block" id="BasicPage.set_dispers_sizer"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.set_dispers_sizer">[docs]</a>    <span class="k">def</span> <span class="nf">set_dispers_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill sizer containing dispersity info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;Polydispersity and Orientational Distribution&quot;</span>
+        <span class="n">box_description</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+        <span class="n">box_description</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">BLUE</span><span class="p">)</span>
+        <span class="n">boxsizer1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">box_description</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="c">#----------------------------------------------------</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Off&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</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">RB_GROUP</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;On&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">30</span><span class="p">))</span>
+        <span class="c"># best size for MAC and PC</span>
+        <span class="k">if</span> <span class="n">ON_MAC</span><span class="p">:</span>
+            <span class="n">size_q</span> <span class="o">=</span> <span class="p">(</span><span class="mi">30</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">size_q</span> <span class="o">=</span> <span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_help_bt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span> <span class="s">&#39;?&#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">BU_EXACTFIT</span><span class="p">,</span>
+                                      <span class="n">size</span><span class="o">=</span><span class="n">size_q</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_help_bt</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_BUTTON</span><span class="p">,</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">on_pd_help_clicked</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">disp_help_bt</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_help_bt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Helps for Polydispersion.&quot;</span><span class="p">)</span>
+        
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_dipers_Param</span><span class="p">,</span>
+                     <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_dipers_Param</span><span class="p">,</span>
+                   <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="c">#MAC needs SetValue</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="n">sizer_dispersion</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>
+        <span class="n">sizer_dispersion</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>  <span class="c"># Polydispersity and \nOrientational Distribution &quot;</span>
+        <span class="n">sizer_dispersion</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">name</span><span class="p">))</span>
+        <span class="n">sizer_dispersion</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="p">)</span>
+        <span class="n">sizer_dispersion</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="n">sizer_dispersion</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="p">)</span>
+        <span class="n">sizer_dispersion</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">25</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="n">sizer_dispersion</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disp_help_bt</span><span class="p">)</span>
+        
+        <span class="c">## fill a sizer for dispersion</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_dispersion</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">TOP</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span>
+                <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="p">)</span>
+        <span class="c">#-----------------------------------------------------</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer1</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+     
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="c">## saving the state of enable dispersity button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable_disp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disable_disp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.onResetModel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.onResetModel">[docs]</a>    <span class="k">def</span> <span class="nf">onResetModel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Reset model state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">menu</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="c">## post help message for the selected model</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="n">menu</span><span class="o">.</span><span class="n">GetHelpString</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; reloaded&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="n">menu</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_model_helper</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">m_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">saved_states</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="n">previous_state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">saved_states</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
+            <span class="c">## reset state of checkbox,textcrtl  and  regular parameters value</span>
+            
+            <span class="bp">self</span><span class="o">.</span><span class="n">reset_page</span><span class="p">(</span><span class="n">previous_state</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">m_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">m_name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+               </div>
+<div class="viewcode-block" id="BasicPage.on_preview"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_preview">[docs]</a>    <span class="k">def</span> <span class="nf">on_preview</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Report the current fit results</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Get plot image from plotpanel</span>
+        <span class="n">images</span><span class="p">,</span> <span class="n">canvases</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_images</span><span class="p">()</span>
+        <span class="c"># get the report dialog</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">report</span><span class="p">(</span><span class="n">images</span><span class="p">,</span> <span class="n">canvases</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.on_save"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_save">[docs]</a>    <span class="k">def</span> <span class="nf">on_save</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Save the current state into file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="n">new_state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="c"># Ask the user the location of the file to write to.</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> \
+                        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_default_save_location</span>
+        <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="bp">self</span><span class="p">,</span> <span class="s">&quot;Choose a file&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span><span class="p">,</span>
+                                        <span class="bp">self</span><span class="o">.</span><span class="n">window_caption</span><span class="p">,</span> <span class="s">&quot;*.fitv&quot;</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">SAVE</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span>\
+                                 <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="c"># MAC always needs the extension for saving</span>
+        <span class="n">extens</span> <span class="o">=</span> <span class="s">&quot;.fitv&quot;</span>
+        <span class="c"># Make sure the ext included in the file name</span>
+        <span class="n">fName</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">path</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">extens</span>
+        <span class="c">#the manager write the state into file</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">save_fit_state</span><span class="p">(</span><span class="n">filepath</span><span class="o">=</span><span class="n">fName</span><span class="p">,</span> <span class="n">fitstate</span><span class="o">=</span><span class="n">new_state</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">new_state</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.on_copy"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_copy">[docs]</a>    <span class="k">def</span> <span class="nf">on_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Copy Parameter values to the clipboad</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="c"># It seems MAC needs wxCallAfter</span>
+        <span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">()</span> <span class="o">==</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">COPYEX_ID</span><span class="p">:</span>
+            <span class="k">print</span> <span class="s">&quot;copy excel&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_copy_excel</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">()</span> <span class="o">==</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">COPYLAT_ID</span><span class="p">:</span>
+            <span class="k">print</span> <span class="s">&quot;copy latex&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_copy_latex</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_copy</span><span class="p">)</span>
+
+        </div>
+<div class="viewcode-block" id="BasicPage.on_paste"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_paste">[docs]</a>    <span class="k">def</span> <span class="nf">on_paste</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Paste Parameter values to the panel if possible</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#if event != None:</span>
+        <span class="c">#    event.Skip()</span>
+        <span class="c"># It seems MAC needs wxCallAfter for the setvalues</span>
+        <span class="c"># for multiple textctrl items, otherwise it tends to crash once a while</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_paste</span><span class="p">)</span>
+        <span class="c"># messages depending on the flag</span>
+        <span class="c">#self._copy_info(True)</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_copy_info</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">flag</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Send event dpemding on flag</span>
+<span class="sd">        </span>
+<span class="sd">        : Param flag: flag that distinguish event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># messages depending on the flag</span>
+        <span class="k">if</span> <span class="n">flag</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Parameter values are copied to the clipboard...&quot;</span>
+            <span class="n">infor</span> <span class="o">=</span> <span class="s">&#39;warning&#39;</span>
+        <span class="k">elif</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Parameter values are pasted from the clipboad...&quot;</span>
+            <span class="n">infor</span> <span class="o">=</span> <span class="s">&quot;warning&quot;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error occured: &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;No valid parameter values to paste from the clipboard...&quot;</span>
+            <span class="n">infor</span> <span class="o">=</span> <span class="s">&quot;error&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                    <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="n">infor</span><span class="p">))</span>
+        <span class="c"># inform msg to wx</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                    <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="n">infor</span><span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">_get_time_stamp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return time and date stings</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># date and time</span>
+        <span class="n">year</span><span class="p">,</span> <span class="n">month</span><span class="p">,</span> <span class="n">day</span><span class="p">,</span> <span class="n">hour</span><span class="p">,</span> <span class="n">minute</span><span class="p">,</span> <span class="n">second</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">()</span>
+        <span class="n">current_time</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">hour</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;:&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">minute</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;:&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">second</span><span class="p">)</span>
+        <span class="n">current_date</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">month</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;/&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">day</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;/&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">year</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">current_time</span><span class="p">,</span> <span class="n">current_date</span>
+      
+<div class="viewcode-block" id="BasicPage.on_bookmark"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_bookmark">[docs]</a>    <span class="k">def</span> <span class="nf">on_bookmark</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save history of the data and model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Can not bookmark; Please select Data and Model first...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="n">new_state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="c">##Add model state on context menu</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">number_saved_state</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">current_time</span><span class="p">,</span> <span class="n">current_date</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_time_stamp</span><span class="p">()</span>
+        <span class="c">#name= self.model.name+&quot;[%g]&quot;%self.number_saved_state</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;Fitting: </span><span class="si">%g</span><span class="s">]&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">number_saved_state</span>
+        <span class="n">name</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span>
+        <span class="n">name</span> <span class="o">+=</span> <span class="s">&quot;bookmarked at </span><span class="si">%s</span><span class="s"> on </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">current_time</span><span class="p">,</span> <span class="n">current_date</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">saved_states</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">new_state</span>
+        
+        <span class="c">## Add item in the context menu</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model saved at </span><span class="si">%s</span><span class="s"> on </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">current_time</span><span class="p">,</span> <span class="n">current_date</span><span class="p">)</span>
+        <span class="c">## post help message for the selected model</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; Saved! right click on this page to retrieve this model&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onResetModel</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                     <span class="n">AppendBookmarkEvent</span><span class="p">(</span><span class="n">title</span><span class="o">=</span><span class="n">name</span><span class="p">,</span>
+                                         <span class="n">hint</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">),</span>
+                                         <span class="n">handler</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_back_to_bookmark</span><span class="p">))</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_back_to_bookmark</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Back to bookmark</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">on_perspective</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">onResetModel</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+                
+<div class="viewcode-block" id="BasicPage.onSetFocus"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.onSetFocus">[docs]</a>    <span class="k">def</span> <span class="nf">onSetFocus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        highlight the current textcrtl and hide the error text control shown</span>
+<span class="sd">        after fitting</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.read_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.read_file">[docs]</a>    <span class="k">def</span> <span class="nf">read_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Read two columns file</span>
+<span class="sd">        </span>
+<span class="sd">        :param path: the path to the file to read</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">path</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                            <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span> \
+                            <span class="s">&quot; Selected Distribution was not loaded: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">path</span><span class="p">))</span>
+                <span class="k">return</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span>
+            <span class="n">input_f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="s">&#39;r&#39;</span><span class="p">)</span>
+            <span class="n">buff</span> <span class="o">=</span> <span class="n">input_f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+            <span class="n">lines</span> <span class="o">=</span> <span class="n">buff</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
+            <span class="n">input_f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+            <span class="n">angles</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="n">weights</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span>
+                <span class="n">toks</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">angle</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+                    <span class="n">weight</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">toks</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                    <span class="n">angles</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">angle</span><span class="p">)</span>
+                    <span class="n">weights</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">weight</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="c"># Skip non-data lines</span>
+                    <span class="k">pass</span>
+            <span class="k">return</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">angles</span><span class="p">),</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">weights</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">raise</span>
+</div>
+<div class="viewcode-block" id="BasicPage.createMemento"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.createMemento">[docs]</a>    <span class="k">def</span> <span class="nf">createMemento</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the current state of the page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.save_current_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.save_current_state">[docs]</a>    <span class="k">def</span> <span class="nf">save_current_state</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store current state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">engine_type</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="bp">self</span><span class="o">.</span><span class="n">engine_type</span><span class="p">)</span>
+        <span class="c">## save model option</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getDispParamList</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disp_list</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="bp">self</span><span class="o">.</span><span class="n">disp_list</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+            
+            <span class="c">#model combobox: complex code because of mac&#39;s silent error</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">structurecombobox</span> <span class="o">=</span> <span class="s">&#39;None&#39;</span>
+                    <span class="n">s_select</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="n">s_select</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">structurecombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span>\
+                        <span class="n">GetString</span><span class="p">(</span><span class="n">s_select</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">f_select</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">f_select</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">formfactorcombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span>\
+                    <span class="n">GetString</span><span class="p">(</span><span class="n">f_select</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">cb_select</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">cb_select</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">categorycombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span>\
+                <span class="n">GetString</span><span class="p">(</span><span class="n">cb_select</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable2D</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="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">values</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="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">weights</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="bp">self</span><span class="o">.</span><span class="n">weights</span><span class="p">)</span>
+        <span class="c">## save data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">data</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="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dI_noweight</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="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dI_didata</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="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dI_sqrdata</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="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dI_idata</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="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dq_l</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dq_l</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dq_r</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dq_r</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;enable_disp&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable_disp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disable_disp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">smearer</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="bp">self</span><span class="o">.</span><span class="n">current_smearer</span><span class="p">)</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;enable_smearer&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable_smearer</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="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disable_smearer</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="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">pinhole_smearer</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="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dx_max</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="bp">self</span><span class="o">.</span><span class="n">dx_max</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dx_min</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="bp">self</span><span class="o">.</span><span class="n">dx_min</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dxl</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="bp">self</span><span class="o">.</span><span class="n">dxl</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dxw</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="bp">self</span><span class="o">.</span><span class="n">dxw</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">slit_smearer</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="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                  
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span>
+
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">values</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="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">weights</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="bp">self</span><span class="o">.</span><span class="n">weights</span><span class="p">)</span>
+        <span class="c">## save plotting range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_save_plotting_range</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">orientation_params</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">orientation_params_disp</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">parameters</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">fittable_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">fixed_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">str_parameters</span> <span class="o">=</span> <span class="p">[]</span>
+
+        <span class="c">## save checkbutton state and txtcrtl values</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">,</span>
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">,</span>
+                                     <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">,</span>
+                                     <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">,</span>
+                                     <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">)</span>
+        <span class="c">#save chisqr</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">tcChi</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.save_current_state_fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.save_current_state_fit">[docs]</a>    <span class="k">def</span> <span class="nf">save_current_state_fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store current state for fit_page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## save model option</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getDispParamList</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disp_list</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="bp">self</span><span class="o">.</span><span class="n">disp_list</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;engine_type&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">engine_type</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="bp">self</span><span class="o">.</span><span class="n">engine_type</span><span class="p">)</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable2D</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="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">values</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="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">weights</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="bp">self</span><span class="o">.</span><span class="n">weights</span><span class="p">)</span>
+        <span class="c">## save data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">data</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="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;enable_disp&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable_disp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disable_disp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">smearer</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="bp">self</span><span class="o">.</span><span class="n">current_smearer</span><span class="p">)</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;enable_smearer&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable_smearer</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="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disable_smearer</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="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">pinhole_smearer</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="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">slit_smearer</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="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dI_noweight</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="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dI_didata</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="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dI_sqrdata</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="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">dI_idata</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="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;disp_box&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_box</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disp_box</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_box</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                    <span class="k">if</span> <span class="n">v</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span>
+                        
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">values</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="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">weights</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="bp">self</span><span class="o">.</span><span class="n">weights</span><span class="p">)</span>
+           
+        <span class="c">## save plotting range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_save_plotting_range</span><span class="p">()</span>
+        
+        <span class="c">## save checkbutton state and txtcrtl values</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">,</span>
+                                     <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">,</span>
+                                     <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">,</span>
+                                             <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.check_invalid_panel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.check_invalid_panel">[docs]</a>    <span class="k">def</span> <span class="nf">check_invalid_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        check if the user can already perform some action with this panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please load Data and select Model to start...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="k">return</span>  <span class="bp">True</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.set_model_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.set_model_state">[docs]</a>    <span class="k">def</span> <span class="nf">set_model_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        reset page given a model state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">disp_cb_dict</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">disp_list</span>
+      
+        <span class="c">## set the state of the radio box</span>
+        <span class="c">#self.shape_rbutton.SetValue(state.shape_rbutton)</span>
+        <span class="c">#self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton)</span>
+        <span class="c">#self.struct_rbutton.SetValue(state.struct_rbutton)</span>
+        <span class="c">#self.plugin_rbutton.SetValue(state.plugin_rbutton)</span>
+        
+        <span class="c">## fill model combobox</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_show_combox_helper</span><span class="p">()</span>
+        <span class="c">#select the current model</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># to support older version</span>
+            <span class="n">category_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">categorycombobox</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">category_pos</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">for</span> <span class="n">ind_cat</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorycombobox</span><span class="o">.</span><span class="n">GetString</span><span class="p">(</span><span class="n">ind_form</span><span class="p">)</span> <span class="o">==</span> \
+                                        <span class="n">state</span><span class="o">.</span><span class="n">categorycombobox</span><span class="p">:</span>
+                    <span class="n">category_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">ind_cat</span><span class="p">)</span>
+                    <span class="k">break</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="n">category_pos</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># to support older version</span>
+            <span class="n">formfactor_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">formfactorcombobox</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">formfactor_pos</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">for</span> <span class="n">ind_form</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetString</span><span class="p">(</span><span class="n">ind_form</span><span class="p">)</span> <span class="o">==</span> \
+                                        <span class="n">state</span><span class="o">.</span><span class="n">formfactorcombobox</span><span class="p">:</span>
+                    <span class="n">formfactor_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">ind_form</span><span class="p">)</span>
+                    <span class="k">break</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="n">formfactor_pos</span><span class="p">)</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># to support older version</span>
+            <span class="n">structfactor_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">structurecombobox</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">structfactor_pos</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">for</span> <span class="n">ind_struct</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">GetString</span><span class="p">(</span><span class="n">ind_struct</span><span class="p">)</span> <span class="o">==</span> \
+                                        <span class="n">state</span><span class="o">.</span><span class="n">structurecombobox</span><span class="p">:</span>
+                    <span class="n">structfactor_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">ind_struct</span><span class="p">)</span>
+                    <span class="k">break</span>
+                
+        <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">structfactor_pos</span><span class="p">)</span>
+        
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">multi_factor</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">multi_factor</span><span class="p">)</span>
+            
+        <span class="c">## reset state of checkbox,textcrtl  and  regular parameters value</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">,</span>
+                                     <span class="n">state</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">,</span>
+                                     <span class="n">state</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">,</span>
+                                     <span class="n">state</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">,</span> <span class="n">state</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span>
+        <span class="c">## display dispersion info layer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">enable_disp</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">disable_disp</span><span class="p">)</span>
+        
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;disp_box&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_box</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disp_box</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">disp_box</span><span class="p">)</span>
+            <span class="n">n</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_box</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+            <span class="n">dispersity</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_box</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">n</span><span class="p">)</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">dispersity</span><span class="o">.</span><span class="n">__name__</span>
+
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_dipers_Param</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+       
+            <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;ArrayDispersion&quot;</span><span class="p">:</span>
+                
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                    
+                    <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">[</span><span class="n">item</span><span class="p">],</span> <span class="s">&quot;SetValue&quot;</span><span class="p">):</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">[</span><span class="n">item</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span>\
+                                                    <span class="n">state</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">[</span><span class="n">item</span><span class="p">])</span>
+                        <span class="c"># Create the dispersion objects</span>
+                        <span class="kn">from</span> <span class="nn">sas.models.dispersion_models</span> <span class="kn">import</span> <span class="n">ArrayDispersion</span>
+                        <span class="n">disp_model</span> <span class="o">=</span> <span class="n">ArrayDispersion</span><span class="p">()</span>
+                        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">state</span><span class="p">,</span> <span class="s">&quot;values&quot;</span><span class="p">)</span> <span class="ow">and</span> \
+                                 <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">[</span><span class="n">item</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+                            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">values</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                                <span class="bp">self</span><span class="o">.</span><span class="n">values</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">values</span>
+                                <span class="bp">self</span><span class="o">.</span><span class="n">weights</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">weights</span>
+                                <span class="n">disp_model</span><span class="o">.</span><span class="n">set_weights</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">,</span>
+                                                       <span class="n">state</span><span class="o">.</span><span class="n">weights</span><span class="p">)</span>
+                            <span class="k">else</span><span class="p">:</span>
+                                <span class="bp">self</span><span class="o">.</span><span class="n">_reset_dispersity</span><span class="p">()</span>
+                        
+                        <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="n">disp_model</span>
+                        <span class="c"># Set the new model as the dispersion object</span>
+                        <span class="c">#for the selected parameter</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_dispersion</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">disp_model</span><span class="p">)</span>
+                    
+                        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">_persistency_dict</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> \
+                                                <span class="p">[</span><span class="n">state</span><span class="o">.</span><span class="n">values</span><span class="p">,</span> <span class="n">state</span><span class="o">.</span><span class="n">weights</span><span class="p">]</span>
+                    
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">keys</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParamList</span><span class="p">()</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="ow">and</span> \
+                        <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</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">state</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disp_cb_dict</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">state</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">)</span>
+        <span class="c">## smearing info  restore</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;enable_smearer&quot;</span><span class="p">):</span>
+            <span class="c">## set smearing value whether or not the data</span>
+            <span class="c">#contain the smearing info</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">enable_smearer</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">disable_smearer</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">onSmear</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">slit_smearer</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">dI_noweight</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">dI_didata</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">dI_idata</span><span class="p">)</span>
+        
+        <span class="c">## we have two more options for smearing</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">onPinholeSmear</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">onSlitSmear</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+       
+        <span class="c">## reset state of checkbox,textcrtl  and dispersity parameters value</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">,</span> <span class="n">state</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">,</span> <span class="n">state</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">)</span>
+        
+        <span class="c">## draw the model with previous parameters value</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_onparamEnter_helper</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">select_param</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="c">#Save state_fit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state_fit</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_lay_out</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.reset_page_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.reset_page_helper">[docs]</a>    <span class="k">def</span> <span class="nf">reset_page_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Use page_state and change the state of existing page</span>
+<span class="sd">        </span>
+<span class="sd">        :precondition: the page is already drawn or created</span>
+<span class="sd">        </span>
+<span class="sd">        :postcondition: the state of the underlying data change as well as the</span>
+<span class="sd">            state of the graphic interface</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">state</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c"># set data, etc. from the state</span>
+        <span class="c"># reset page between theory and fitting from bookmarking</span>
+        <span class="c">#if state.data == None:</span>
+        <span class="c">#    data = None</span>
+        <span class="c">#else:</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span>
+
+        <span class="k">if</span> <span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data_min</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">qmin</span>
+            <span class="n">data_max</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">qmax</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="n">data_min</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="n">data_max</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data_min</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data_max</span><span class="p">))</span>
+
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">data</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">enable2D</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">magnetic_on</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c"># Backward compatibility (for older state files)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">engine_type</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">engine_type</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">disp_cb_dict</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">disp_list</span>
+      
+        <span class="c">## set the state of the radio box</span>
+        <span class="c">#self.shape_rbutton.SetValue(state.shape_rbutton)</span>
+        <span class="c">#self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton)</span>
+        <span class="c">#self.struct_rbutton.SetValue(state.struct_rbutton)</span>
+        <span class="c">#self.plugin_rbutton.SetValue(state.plugin_rbutton)</span>
+        
+        <span class="c">## fill model combobox</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_show_combox_helper</span><span class="p">()</span>
+        <span class="c">#select the current model</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># to support older version</span>
+            <span class="n">category_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">categorycombobox</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">category_pos</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">for</span> <span class="n">ind_cat</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">GetString</span><span class="p">(</span><span class="n">ind_cat</span><span class="p">)</span> <span class="o">==</span> \
+                                        <span class="n">state</span><span class="o">.</span><span class="n">categorycombobox</span><span class="p">:</span>
+                    <span class="n">category_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">ind_cat</span><span class="p">)</span>
+                    <span class="k">break</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="n">category_pos</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_show_combox</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># to support older version</span>
+            <span class="n">formfactor_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">formfactorcombobox</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">formfactor_pos</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">for</span> <span class="n">ind_form</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetString</span><span class="p">(</span><span class="n">ind_form</span><span class="p">)</span> <span class="o">==</span> \
+                                                    <span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">formfactorcombobox</span><span class="p">):</span>
+                    <span class="n">formfactor_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">ind_form</span><span class="p">)</span>
+                    <span class="k">break</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="n">formfactor_pos</span><span class="p">)</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># to support older version</span>
+            <span class="n">structfactor_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">structurecombobox</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">structfactor_pos</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">for</span> <span class="n">ind_struct</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()):</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">GetString</span><span class="p">(</span><span class="n">ind_struct</span><span class="p">)</span> <span class="o">==</span> \
+                                                    <span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">structurecombobox</span><span class="p">):</span>
+                    <span class="n">structfactor_pos</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">ind_struct</span><span class="p">)</span>
+                    <span class="k">break</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">structfactor_pos</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">multi_factor</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">multi_factor</span><span class="p">)</span>
+
+        <span class="c">#reset the fitting engine type</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">engine_type</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">engine_type</span>
+        <span class="c">#draw the pnael according to the new model parameter</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_model</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+            
+        <span class="c"># take care of 2D button</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;2D Mode&quot;</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;1D Mode&quot;</span><span class="p">)</span>
+        <span class="c"># else:</span>
+                
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine_type</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">_on_change_engine</span><span class="p">(</span><span class="n">engine</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">engine_type</span><span class="p">)</span>
+        <span class="c">## set the select all check box to the a given state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">cb1</span><span class="p">)</span>
+     
+        <span class="c">## reset state of checkbox,textcrtl  and  regular parameters value</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">,</span>
+                                     <span class="n">state</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">,</span>
+                                     <span class="n">state</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">,</span>
+                                     <span class="n">state</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">,</span> <span class="n">state</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span>
+        <span class="c">## display dispersion info layer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">enable_disp</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">disable_disp</span><span class="p">)</span>
+        <span class="c"># If the polydispersion is ON</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">enable_disp</span><span class="p">:</span>
+            <span class="c"># reset dispersion according the state</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_dipers_Param</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_reset_page_disp_helper</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+        <span class="c">##plotting range restore</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_plotting_range</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+        <span class="c">## smearing info  restore</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;enable_smearer&quot;</span><span class="p">):</span>
+            <span class="c">## set smearing value whether or not the data</span>
+            <span class="c">#contain the smearing info</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">enable_smearer</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">disable_smearer</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">onSmear</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">slit_smearer</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">dI_noweight</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">dI_didata</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">dI_idata</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c"># to support older state file formats</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+ 
+        <span class="c">## we have two more options for smearing</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">dx_min</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">dx_max</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_min</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span><span class="p">))</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_max</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">onPinholeSmear</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">dxl</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">dxw</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dxl</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dxl</span><span class="p">))</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dxw</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dxw</span><span class="p">))</span>  
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>  
+            <span class="bp">self</span><span class="o">.</span><span class="n">onSlitSmear</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        
+        <span class="c">## reset state of checkbox,textcrtl  and dispersity parameters value</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">,</span> <span class="n">state</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">,</span> <span class="n">state</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">)</span>
+        
+        <span class="c">## draw the model with previous parameters value</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_onparamEnter_helper</span><span class="p">()</span>
+        <span class="c">#reset the value of chisqr when not consistent with the value computed</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">tcChi</span><span class="p">))</span>
+        <span class="c">## reset context menu items</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_context_menu</span><span class="p">()</span>
+        
+        <span class="c">## set the value of the current state to the state given as parameter</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">m_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">m_name</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_reset_page_disp_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Help to rest page for dispersions</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">keys</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParamList</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="ow">and</span> \
+                <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>
+        <span class="c">#for k,v in self.state.disp_cb_dict.iteritems():</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</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">state</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disp_cb_dict</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">state</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">values</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">state</span><span class="o">.</span><span class="n">values</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weights</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">state</span><span class="o">.</span><span class="n">weights</span><span class="p">)</span>
+        
+        <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">disp</span> <span class="ow">in</span> <span class="n">state</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c"># From saved file, disp_model can not be sent in model obj.</span>
+            <span class="c"># it will be sent as a string here, then converted to model object.</span>
+            <span class="k">if</span> <span class="n">disp</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;str&#39;</span><span class="p">:</span>
+                <span class="n">disp_model</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">com_str</span> <span class="o">=</span> <span class="s">&quot;from sas.models.dispersion_models &quot;</span>
+                <span class="n">com_str</span> <span class="o">+=</span> <span class="s">&quot;import </span><span class="si">%s</span><span class="s"> as disp_func </span><span class="se">\n</span><span class="s">disp_model = disp_func()&quot;</span>
+                <span class="k">exec</span> <span class="n">com_str</span> <span class="o">%</span> <span class="n">disp</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">disp_model</span> <span class="o">=</span> <span class="n">disp</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">disp_model</span>
+            <span class="n">param_name</span> <span class="o">=</span> <span class="n">key</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="c"># Try to set dispersion only when available</span>
+            <span class="c"># for eg., pass the orient. angles for 1D Cal</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_dispersion</span><span class="p">(</span><span class="n">param_name</span><span class="p">,</span> <span class="n">disp_model</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">_persistency_dict</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> \
+                                 <span class="p">[</span><span class="n">state</span><span class="o">.</span><span class="n">values</span><span class="p">,</span> <span class="n">state</span><span class="o">.</span><span class="n">weights</span><span class="p">]</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+            <span class="n">selection</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_polyfunc_selection</span><span class="p">(</span><span class="n">disp_model</span><span class="p">)</span>
+            <span class="k">for</span> <span class="nb">list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">:</span>
+                <span class="k">if</span> <span class="nb">list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="n">key</span> <span class="ow">and</span> <span class="nb">list</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="nb">list</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">selection</span><span class="p">)</span>
+                    <span class="c"># For the array disp_model, set the values and weights</span>
+                    <span class="k">if</span> <span class="n">selection</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                        <span class="n">disp_model</span><span class="o">.</span><span class="n">set_weights</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">[</span><span class="n">key</span><span class="p">],</span>
+                                               <span class="bp">self</span><span class="o">.</span><span class="n">weights</span><span class="p">[</span><span class="n">key</span><span class="p">])</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="c"># Diables all fittable params for array</span>
+                            <span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                            <span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                            <span class="nb">list</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                            <span class="nb">list</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                            <span class="nb">list</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="k">pass</span>
+            <span class="c"># For array, disable all fixed params</span>
+            <span class="k">if</span> <span class="n">selection</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;.&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">key</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;.&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]:</span>
+                        <span class="c"># try it and pass it for the orientation for 1D</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="k">pass</span>
+    
+        <span class="c"># Make sure the check box updated when all checked</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">select_all_param</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+      
+    <span class="k">def</span> <span class="nf">_selectDlg</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        open a dialog file to selected the customized dispersity </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> \
+                        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_save_location</span><span class="p">()</span>
+        <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="bp">self</span><span class="p">,</span> <span class="s">&quot;Choose a weight file&quot;</span><span class="p">,</span>
+                                <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">,</span>
+                                <span class="s">&quot;*.*&quot;</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">OPEN</span><span class="p">)</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">path</span>
+
+    <span class="k">def</span> <span class="nf">_reset_context_menu</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        reset the context menu</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_states</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">number_saved_state</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="c">## Add item in the context menu</span>
+            <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;Save model and state </span><span class="si">%g</span><span class="s">&#39;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">number_saved_state</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">msg</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onResetModel</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_reset_plotting_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Reset the plotting range to a given state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">qmin</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">qmax</span><span class="p">))</span>
+
+    <span class="k">def</span> <span class="nf">_save_typeOfmodel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save radiobutton containing the type model that can be selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#self.state.shape_rbutton = self.shape_rbutton.GetValue()</span>
+        <span class="c">#self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue()</span>
+        <span class="c">#self.state.struct_rbutton = self.struct_rbutton.GetValue()</span>
+        <span class="c">#self.state.plugin_rbutton = self.plugin_rbutton.GetValue()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">structurecombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">formfactorcombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">categorycombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+       
+        <span class="c">## post state to fit panel</span>
+        <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_save_plotting_range</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save the state of plotting range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">npts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span>
+            
+    <span class="k">def</span> <span class="nf">_onparamEnter_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        check if values entered by the user are changed and valid to replot</span>
+<span class="sd">        model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Flag to register when a parameter has changed.</span>
+        <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">is_2Ddata</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">#self._undo.Enable(True)</span>
+        <span class="c"># check if 2d data</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+            <span class="n">is_2Ddata</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_value_enter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">,</span>
+                                                     <span class="n">is_modified</span><span class="p">)</span>
+                <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_value_enter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">,</span>
+                                                      <span class="n">is_modified</span><span class="p">)</span>
+                <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_value_enter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">,</span>
+                                                      <span class="n">is_modified</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+
+            <span class="c"># Here we should check whether the boundaries have been modified.</span>
+            <span class="c"># If qmin and qmax have been modified, update qmin and qmax and</span>
+            <span class="c"># set the is_modified flag to True</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">):</span>
+                <span class="n">tempmin</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                <span class="k">if</span> <span class="n">tempmin</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="n">tempmin</span>
+                    <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">tempmax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                <span class="k">if</span> <span class="n">tempmax</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="n">tempmax</span>
+                    <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">True</span>
+            
+                <span class="k">if</span> <span class="n">is_2Ddata</span><span class="p">:</span>
+                    <span class="c"># set mask</span>
+                    <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_Npts</span><span class="p">()</span>
+                    
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">False</span>
+                
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+                <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">True</span>
+
+            <span class="c">## if any value is modify draw model with new value</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span><span class="p">:</span>
+                <span class="c">#self.btFit.Disable()</span>
+                <span class="k">if</span> <span class="n">is_2Ddata</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">is_2Ddata</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">is_modified</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span><span class="p">:</span>
+                <span class="c"># Theory case: need to get npts value to draw</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">create_default_data</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">state_change</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">is_modified</span>
+    
+    <span class="k">def</span> <span class="nf">_update_paramv_on_fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        make sure that update param values just before the fitting</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#flag for qmin qmax check values</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">False</span>
+
+        <span class="c">#wx.PostEvent(self._manager.parent, StatusEvent(status=&quot; \</span>
+        <span class="c">#updating ... &quot;,type=&quot;update&quot;))</span>
+
+        <span class="c">##So make sure that update param values on_Fit.</span>
+        <span class="c">#self._undo.Enable(True)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_fit_data</span><span class="p">(</span><span class="n">data</span><span class="o">=</span>\
+                                                                <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">])</span>
+            <span class="c">##Check the values</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_check_value_enter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">,</span> <span class="n">is_modified</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_check_value_enter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">,</span> <span class="n">is_modified</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_check_value_enter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">,</span> <span class="n">is_modified</span><span class="p">)</span>
+
+            <span class="c"># If qmin and qmax have been modified, update qmin and qmax and </span>
+            <span class="c"># Here we should check whether the boundaries have been modified.</span>
+            <span class="c"># If qmin and qmax have been modified, update qmin and qmax and </span>
+            <span class="c"># set the is_modified flag to True</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span><span class="p">:</span>
+                <span class="n">tempmin</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                <span class="k">if</span> <span class="n">tempmin</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="n">tempmin</span>
+                <span class="n">tempmax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                <span class="k">if</span> <span class="n">tempmax</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="n">tempmax</span>
+                <span class="k">if</span> <span class="n">tempmax</span> <span class="o">==</span> <span class="n">tempmin</span><span class="p">:</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="n">temp_smearer</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                    <span class="n">temp_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">update_slit_smear</span><span class="p">()</span>
+                    <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">update_pinhole_smear</span><span class="p">()</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_smearer</span><span class="p">(</span><span class="n">smearer</span><span class="o">=</span><span class="n">temp_smearer</span><span class="p">,</span>
+                                                  <span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span>
+                                                  <span class="n">fid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
+                                                  <span class="n">qmin</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">),</span>
+                                                  <span class="n">qmax</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">),</span>
+                            <span class="n">enable_smearer</span><span class="o">=</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">(),</span>
+                                                      <span class="n">draw</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+                <span class="k">elif</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_smearer</span><span class="p">(</span><span class="n">smearer</span><span class="o">=</span><span class="n">temp_smearer</span><span class="p">,</span>
+                                              <span class="n">qmin</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">),</span>
+                                              <span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span>
+                                              <span class="n">fid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
+                                              <span class="n">qmax</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">),</span>
+                            <span class="n">enable_smearer</span><span class="o">=</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">(),</span>
+                                                 <span class="n">draw</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="n">index_data</span> <span class="o">=</span> <span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span> <span class="o">&amp;</span> \
+                                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">))</span>
+                        <span class="n">val</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">[</span><span class="n">index_data</span> <span class="o">==</span> <span class="bp">True</span><span class="p">]))</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="c"># No data in the panel</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+                            <span class="k">return</span> <span class="n">flag</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+                    <span class="c"># only 2D case set mask</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_Npts</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+                        <span class="k">return</span> <span class="n">flag</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+
+        <span class="c">#For invalid q range, disable the mask editor and fit button, vs.</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">()</span> <span class="ow">and</span>  <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Cannot Plot or Fit :Must select a &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; model or Fitting range is not valid!!!  &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+   
+        <span class="k">return</span> <span class="n">flag</span>
+               
+    <span class="k">def</span> <span class="nf">_is_modified</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">is_modified</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return to self._is_modified</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="n">is_modified</span>
+                       
+    <span class="k">def</span> <span class="nf">_reset_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">listtorestore</span><span class="p">,</span> <span class="n">statelist</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Reset the parameters at the given state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">statelist</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">listtorestore</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">statelist</span><span class="p">)</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">listtorestore</span><span class="p">):</span>
+            <span class="k">return</span>
+
+        <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">listtorestore</span><span class="p">)):</span>
+            <span class="n">item_page</span> <span class="o">=</span> <span class="n">listtorestore</span><span class="p">[</span><span class="n">j</span><span class="p">]</span>
+            <span class="n">item_page_info</span> <span class="o">=</span> <span class="n">statelist</span><span class="p">[</span><span class="n">j</span><span class="p">]</span>
+            <span class="c">##change the state of the check box for simple parameters</span>
+            <span class="k">if</span> <span class="n">item_page</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">item_page</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">item_page_info</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="k">if</span> <span class="n">item_page</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">item_page</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">item_page_info</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
+                <span class="k">if</span> <span class="n">item_page</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;ComboBox&quot;</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">item_page_info</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span><span class="p">:</span>
+                        <span class="n">fun_val</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span><span class="p">[</span><span class="n">item_page_info</span><span class="p">[</span><span class="mi">2</span><span class="p">]]</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">item_page_info</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">fun_val</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">item_page</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="c">## show or hide text +/-</span>
+                <span class="k">if</span> <span class="n">item_page_info</span><span class="p">[</span><span class="mi">2</span><span class="p">]:</span>
+                    <span class="n">item_page</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">item_page</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">item_page</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="c">## show of hide the text crtl for fitting error</span>
+                <span class="k">if</span> <span class="n">item_page_info</span><span class="p">[</span><span class="mi">4</span><span class="p">][</span><span class="mi">0</span><span class="p">]:</span>
+                    <span class="n">item_page</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="n">item_page</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">item_page_info</span><span class="p">[</span><span class="mi">4</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">item_page</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">item_page</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="c">## show of hide the text crtl for fitting error</span>
+                <span class="n">item_page</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="n">item_page_info</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="n">item_page</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">item_page_info</span><span class="p">[</span><span class="mi">5</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
+                
+            <span class="k">if</span> <span class="n">item_page</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="c">## show of hide the text crtl for fitting error</span>
+                <span class="n">item_page</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="n">item_page_info</span><span class="p">[</span><span class="mi">6</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
+                <span class="n">item_page</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">item_page_info</span><span class="p">[</span><span class="mi">6</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
+                    
+    <span class="k">def</span> <span class="nf">_reset_strparam_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">listtorestore</span><span class="p">,</span> <span class="n">statelist</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Reset the string parameters at the given state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">statelist</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">return</span>
+
+        <span class="n">listtorestore</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">statelist</span><span class="p">)</span>
+        
+        <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">listtorestore</span><span class="p">)):</span>
+            <span class="n">item_page</span> <span class="o">=</span> <span class="n">listtorestore</span><span class="p">[</span><span class="n">j</span><span class="p">]</span>
+            <span class="n">item_page_info</span> <span class="o">=</span> <span class="n">statelist</span><span class="p">[</span><span class="n">j</span><span class="p">]</span>
+            <span class="c">##change the state of the check box for simple parameters</span>
+            
+            <span class="k">if</span> <span class="n">item_page</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">item_page</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">item_page_info</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="bp">True</span><span class="p">))</span>
+
+            <span class="k">if</span> <span class="n">item_page</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">param_name</span> <span class="o">=</span> <span class="n">item_page_info</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="n">item_page_info</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
+                <span class="n">selection</span> <span class="o">=</span> <span class="n">value</span>
+                <span class="k">if</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span><span class="p">:</span>
+                    <span class="n">selection</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span><span class="p">[</span><span class="n">value</span><span class="p">]</span>
+                <span class="n">item_page</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">selection</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">param_name</span><span class="p">,</span> <span class="n">selection</span><span class="p">)</span>
+                                      
+    <span class="k">def</span> <span class="nf">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">listtocopy</span><span class="p">,</span> <span class="n">statelist</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        copy the state of button</span>
+<span class="sd">        </span>
+<span class="sd">        :param listtocopy: the list of check button to copy</span>
+<span class="sd">        :param statelist: list of state object to store the current state</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">listtocopy</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">return</span>
+       
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">listtocopy</span><span class="p">:</span>
+  
+            <span class="n">checkbox_state</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">checkbox_state</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">parameter_name</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            <span class="n">parameter_value</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">parameter_value</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">static_text</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">static_text</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">()</span>
+            <span class="n">error_value</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">error_state</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">error_value</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+                <span class="n">error_state</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">()</span>
+                
+            <span class="n">min_value</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">min_state</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">min_value</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+                <span class="n">min_state</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">()</span>
+                
+            <span class="n">max_value</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">max_state</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">max_value</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+                <span class="n">max_state</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">()</span>
+            <span class="n">unit</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">unit</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+               
+            <span class="n">statelist</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">checkbox_state</span><span class="p">,</span> <span class="n">parameter_name</span><span class="p">,</span> <span class="n">parameter_value</span><span class="p">,</span>
+                              <span class="n">static_text</span><span class="p">,</span> <span class="p">[</span><span class="n">error_state</span><span class="p">,</span> <span class="n">error_value</span><span class="p">],</span>
+                              <span class="p">[</span><span class="n">min_state</span><span class="p">,</span> <span class="n">min_value</span><span class="p">],</span>
+                              <span class="p">[</span><span class="n">max_state</span><span class="p">,</span> <span class="n">max_value</span><span class="p">],</span> <span class="n">unit</span><span class="p">])</span>
+           
+<span class="c">#    The following funcion seems to be superseded with fillsizer and </span>
+<span class="c">#    init combo box.  certainly it seems not to know about categories and uses </span>
+<span class="c">#    only shapes and shape independent -- tested after commenting out and does</span>
+<span class="c">#    not seem to cause problem.  Leave commented out for now but delete in</span>
+<span class="c">#    a code cleanup once clear it really is no longer used.</span>
+<span class="c">#    PDB  8 April 2014</span>
+
+<span class="c">#    def _set_model_sizer_selection(self, model):</span>
+<span class="c">#        &quot;&quot;&quot;</span>
+<span class="c">#        Display the sizer according to the type of the current model</span>
+<span class="c">#        &quot;&quot;&quot;</span>
+<span class="c">#        if model == None:</span>
+<span class="c">#            return</span>
+<span class="c">#        if hasattr(model, &quot;s_model&quot;):</span>
+<span class="c">#            </span>
+<span class="c">#            class_name = model.s_model.__class__</span>
+<span class="c">#            name = model.s_model.name</span>
+<span class="c">#            flag = (name != &quot;NoStructure&quot;)</span>
+<span class="c">#            if flag and \</span>
+<span class="c">#                (class_name in self.model_list_box[&quot;Structure Factors&quot;]):</span>
+<span class="c">#                self.structurebox.Show()</span>
+<span class="c">#                self.text2.Show()</span>
+<span class="c">#                self.structurebox.Enable()</span>
+<span class="c">#               self.text2.Enable()</span>
+ <span class="c">#               items = self.structurebox.GetItems()</span>
+ <span class="c">#               self.sizer1.Layout()</span>
+ <span class="c">#               </span>
+ <span class="c">#               for i in range(len(items)):</span>
+ <span class="c">#                   if items[i] == str(name):</span>
+ <span class="c">#                       self.structurebox.SetSelection(i)</span>
+ <span class="c">#                       break</span>
+ <span class="c">#                   </span>
+ <span class="c">#       if hasattr(model, &quot;p_model&quot;):</span>
+ <span class="c">#           class_name = model.p_model.__class__</span>
+ <span class="c">#           name = model.p_model.name</span>
+ <span class="c">#           self.formfactorbox.Clear()</span>
+ <span class="c">#           </span>
+ <span class="c">#           for k, list in self.model_list_box.iteritems():</span>
+ <span class="c">#               if k in[&quot;P(Q)*S(Q)&quot;, &quot;Shapes&quot;] and \</span>
+ <span class="c">#                   class_name in self.model_list_box[&quot;Shapes&quot;]:</span>
+ <span class="c">#                   self.shape_rbutton.SetValue(True)</span>
+ <span class="c">#                   ## fill the form factor list with new model</span>
+ <span class="c">#                   self._populate_box(self.formfactorbox,</span>
+ <span class="c">#                                      self.model_list_box[&quot;Shapes&quot;])</span>
+ <span class="c">#                   items = self.formfactorbox.GetItems()</span>
+ <span class="c">#                   ## set comboxbox to the selected item</span>
+ <span class="c">#                   for i in range(len(items)):</span>
+ <span class="c">#                       if items[i] == str(name):</span>
+ <span class="c">#                           self.formfactorbox.SetSelection(i)</span>
+ <span class="c">#                           break</span>
+ <span class="c">#                   return</span>
+ <span class="c">#               elif k == &quot;Shape-Independent&quot;:</span>
+ <span class="c">#                   self.shape_indep_rbutton.SetValue(True)</span>
+ <span class="c">#               elif k == &quot;Structure Factors&quot;:</span>
+ <span class="c">#                   self.struct_rbutton.SetValue(True)</span>
+ <span class="c">#               elif k == &quot;Multi-Functions&quot;:</span>
+ <span class="c">#                   continue</span>
+ <span class="c">#               else:</span>
+ <span class="c">#                   self.plugin_rbutton.SetValue(True)</span>
+ <span class="c">#              </span>
+ <span class="c">#               if class_name in list:</span>
+ <span class="c">#                   ## fill the form factor list with new model</span>
+ <span class="c">#                   self._populate_box(self.formfactorbox, list)</span>
+ <span class="c">#                   items = self.formfactorbox.GetItems()</span>
+ <span class="c">#                   ## set comboxbox to the selected item</span>
+ <span class="c">#                   for i in range(len(items)):</span>
+ <span class="c">#                       if items[i] == str(name):</span>
+ <span class="c">#                           self.formfactorbox.SetSelection(i)</span>
+ <span class="c">#                           break</span>
+ <span class="c">#                   break</span>
+ <span class="c">#       else:</span>
+            <span class="c">## Select the model from the menu</span>
+<span class="c">#            class_name = model.__class__</span>
+<span class="c">#            name = model.name</span>
+<span class="c">#            self.formfactorbox.Clear()</span>
+<span class="c">#            items = self.formfactorbox.GetItems()</span>
+<span class="c">#    </span>
+<span class="c">#            for k, list in self.model_list_box.iteritems():</span>
+<span class="c">#                if k in[&quot;P(Q)*S(Q)&quot;, &quot;Shapes&quot;] and \</span>
+<span class="c">#                    class_name in self.model_list_box[&quot;Shapes&quot;]:</span>
+<span class="c">#                    if class_name in self.model_list_box[&quot;P(Q)*S(Q)&quot;]:</span>
+<span class="c">#                        self.structurebox.Show()</span>
+<span class="c">#                        self.text2.Show()</span>
+<span class="c">#                       self.structurebox.Enable()</span>
+<span class="c">#                       self.structurebox.SetSelection(0)</span>
+<span class="c">#                       self.text2.Enable()</span>
+<span class="c">#                   else:</span>
+<span class="c">#                        self.structurebox.Hide()</span>
+<span class="c">#                        self.text2.Hide()</span>
+<span class="c">#                        self.structurebox.Disable()</span>
+<span class="c">#                        self.structurebox.SetSelection(0)</span>
+<span class="c">#                        self.text2.Disable()</span>
+<span class="c">#                        </span>
+<span class="c">#                    self.shape_rbutton.SetValue(True)</span>
+                    <span class="c">## fill the form factor list with new model</span>
+<span class="c">#                    self._populate_box(self.formfactorbox,</span>
+<span class="c">#                                       self.model_list_box[&quot;Shapes&quot;])</span>
+<span class="c">#                    items = self.formfactorbox.GetItems()</span>
+<span class="c">#                    ## set comboxbox to the selected item</span>
+<span class="c">#                    for i in range(len(items)):</span>
+<span class="c">#                        if items[i] == str(name):</span>
+<span class="c">#                            self.formfactorbox.SetSelection(i)</span>
+<span class="c">#                            break</span>
+<span class="c">#                    return</span>
+<span class="c">#                elif k == &quot;Shape-Independent&quot;:</span>
+<span class="c">#                    self.shape_indep_rbutton.SetValue(True)</span>
+<span class="c">#                elif k == &quot;Structure Factors&quot;:</span>
+<span class="c">#                    self.struct_rbutton.SetValue(True)</span>
+<span class="c">#                elif k == &quot;Multi-Functions&quot;:</span>
+<span class="c">#                    continue</span>
+<span class="c">#                else:</span>
+<span class="c">#                    self.plugin_rbutton.SetValue(True)</span>
+<span class="c">#                if class_name in list:</span>
+<span class="c">#                    self.structurebox.SetSelection(0)</span>
+<span class="c">#                    self.structurebox.Disable()</span>
+<span class="c">#                    self.text2.Disable()</span>
+                    <span class="c">## fill the form factor list with new model</span>
+<span class="c">#                    self._populate_box(self.formfactorbox, list)</span>
+<span class="c">#                    items = self.formfactorbox.GetItems()</span>
+                    <span class="c">## set comboxbox to the selected item</span>
+<span class="c">#                    for i in range(len(items)):</span>
+<span class="c">#                        if items[i] == str(name):</span>
+<span class="c">#                            self.formfactorbox.SetSelection(i)</span>
+<span class="c">#                            break</span>
+<span class="c">#                    break</span>
+                
+    <span class="k">def</span> <span class="nf">_draw_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="s">&#39;model&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Method to draw or refresh a plotted model.</span>
+<span class="sd">        The method will use the data member from the model page</span>
+<span class="sd">        to build a call to the fitting perspective manager.</span>
+<span class="sd">        </span>
+<span class="sd">        :param chisqr: update chisqr value [bool]</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_draw_model_after</span><span class="p">,</span> <span class="n">update_chisqr</span><span class="p">,</span> <span class="n">source</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_draw_model_after</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="s">&#39;model&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Method to draw or refresh a plotted model.</span>
+<span class="sd">        The method will use the data member from the model page</span>
+<span class="sd">        to build a call to the fitting perspective manager.</span>
+<span class="sd">        </span>
+<span class="sd">        :param chisqr: update chisqr value [bool]</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#if self.check_invalid_panel():</span>
+        <span class="c">#    return</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">temp_smear</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;enable_smearer&quot;</span><span class="p">):</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                    <span class="n">temp_smear</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span>
+            <span class="c"># compute weight for the current data</span>
+            <span class="kn">from</span> <span class="nn">sas.perspectives.fitting.utils</span> <span class="kn">import</span> <span class="n">get_weight</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_weight_flag</span><span class="p">()</span>
+            <span class="n">weight</span> <span class="o">=</span> <span class="n">get_weight</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="n">is2d</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">(),</span> <span class="n">flag</span><span class="o">=</span><span class="n">flag</span><span class="p">)</span>
+            <span class="n">toggle_mode_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">()</span>
+            <span class="n">is_2d</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">draw_model</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">,</span>
+                                    <span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span>
+                                    <span class="n">smearer</span><span class="o">=</span><span class="n">temp_smear</span><span class="p">,</span>
+                                    <span class="n">qmin</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">),</span>
+                                    <span class="n">qmax</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">),</span>
+                                    <span class="n">page_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span>
+                                    <span class="n">toggle_mode_on</span><span class="o">=</span><span class="n">toggle_mode_on</span><span class="p">,</span>
+                                    <span class="n">state</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="p">,</span>
+                                    <span class="n">enable2D</span><span class="o">=</span><span class="n">is_2d</span><span class="p">,</span>
+                                    <span class="n">update_chisqr</span><span class="o">=</span><span class="n">update_chisqr</span><span class="p">,</span>
+                                    <span class="n">source</span><span class="o">=</span><span class="s">&#39;model&#39;</span><span class="p">,</span>
+                                    <span class="n">weight</span><span class="o">=</span><span class="n">weight</span><span class="p">)</span>
+       
+    <span class="k">def</span> <span class="nf">_on_show_sld</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Plot SLD profile</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get profile data</span>
+        <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getProfile</span><span class="p">()</span>
+
+        <span class="kn">from</span> <span class="nn">sas.plottools</span> <span class="kn">import</span> <span class="n">Data1D</span> <span class="k">as</span> <span class="n">pf_data1d</span>
+        <span class="c">#from sas.perspectives.theory.profile_dialog import SLDPanel</span>
+        <span class="kn">from</span> <span class="nn">sas.guiframe.local_perspectives.plotting.profile_dialog</span> \
+        <span class="kn">import</span> <span class="n">SLDPanel</span>
+        <span class="n">sld_data</span> <span class="o">=</span> <span class="n">pf_data1d</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
+        <span class="n">sld_data</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">&#39;SLD&#39;</span>
+        <span class="n">sld_data</span><span class="o">.</span><span class="n">axes</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sld_axes</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">SLDPanel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">sld_data</span><span class="p">,</span> <span class="n">axes</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">sld_axes</span><span class="p">,</span> <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_set_multfactor_combobox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">multiplicity</span><span class="o">=</span><span class="mi">10</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set comboBox for muitfactor of CoreMultiShellModel</span>
+<span class="sd">        :param multiplicit: no. of multi-functionality</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># build content of the combobox</span>
+        <span class="k">for</span> <span class="n">idx</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">multiplicity</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">idx</span><span class="p">),</span> <span class="nb">int</span><span class="p">(</span><span class="n">idx</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_hide_multfactor_combobox</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_show_multfactor_combobox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show the comboBox of muitfactor of CoreMultiShellModel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text1</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+             
+    <span class="k">def</span> <span class="nf">_hide_multfactor_combobox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Hide the comboBox of muitfactor of CoreMultiShellModel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text1</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+    
+<div class="viewcode-block" id="BasicPage.formfactor_combo_init"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.formfactor_combo_init">[docs]</a>    <span class="k">def</span> <span class="nf">formfactor_combo_init</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        First time calls _show_combox_helper</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_show_combox</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+                </div>
+    <span class="k">def</span> <span class="nf">_show_combox_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill panel&#39;s combo box according to the type of model selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">custom_model</span> <span class="o">=</span> <span class="s">&#39;Customized Models&#39;</span>
+        <span class="n">mod_cat</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">GetStringSelection</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">mod_cat</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">m_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">mod_cat</span> <span class="o">==</span> <span class="n">custom_model</span><span class="p">:</span>
+                <span class="k">for</span> <span class="n">model</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">[</span><span class="n">mod_cat</span><span class="p">]:</span>
+                    <span class="n">str_m</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="p">)</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;.&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+                    <span class="c">#self.model_box.Append(str_m)</span>
+                    <span class="n">m_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_dict</span><span class="p">[</span><span class="n">str_m</span><span class="p">])</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">cat_dic</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">master_category_dict</span><span class="p">[</span><span class="n">mod_cat</span><span class="p">]</span>
+                <span class="k">for</span> <span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">enabled</span><span class="p">)</span> <span class="ow">in</span> <span class="n">cat_dic</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">enabled</span><span class="p">:</span>
+                        <span class="n">m_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_dict</span><span class="p">[</span><span class="n">model</span><span class="p">])</span>
+                    <span class="c">#else:</span>
+                    <span class="c">#    msg = &quot;This model is disabled by Category Manager.&quot; </span>
+                    <span class="c">#    wx.PostEvent(self.parent.parent,</span>
+                    <span class="c">#                 StatusEvent(status=msg, info=&quot;error&quot;))</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_populate_box</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="p">,</span> <span class="n">m_list</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_on_modify_cat</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">on_category_panel</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>  
+        
+    <span class="k">def</span> <span class="nf">_show_combox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show combox box associate with type of model selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_show_combox_helper</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_model</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_save_typeOfmodel</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+  
+    <span class="k">def</span> <span class="nf">_populate_box</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">combobox</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill combox box with dict item</span>
+<span class="sd">        </span>
+<span class="sd">        :param list: contains item to fill the combox</span>
+<span class="sd">            item must model class</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">mlist</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">models</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">:</span>
+            <span class="n">model</span> <span class="o">=</span> <span class="n">models</span><span class="p">()</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span>
+            <span class="k">if</span> <span class="n">models</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&quot;NoStructure&quot;</span><span class="p">:</span>
+                <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="s">&quot;name&quot;</span><span class="p">):</span>
+                    <span class="n">name</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span>
+                <span class="n">mlist</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">name</span><span class="p">,</span> <span class="n">models</span><span class="p">))</span>
+                
+        <span class="c"># Sort the models</span>
+        <span class="n">mlist_sorted</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">mlist</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">mlist_sorted</span><span class="p">:</span>
+            <span class="n">combobox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="k">return</span> <span class="mi">0</span>
+    
+    <span class="k">def</span> <span class="nf">_onQrangeEnter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check validity of value enter in the Q range field</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">tcrtl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="c">#Clear msg if previously shown.</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="c"># Flag to register when a parameter has changed.</span>
+        <span class="c">#is_modified = False</span>
+        <span class="k">if</span> <span class="n">tcrtl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="nb">float</span><span class="p">(</span><span class="n">tcrtl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                <span class="c"># If qmin and qmax have been modified, update qmin and qmax</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">):</span>
+                    <span class="n">tempmin</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="k">if</span> <span class="n">tempmin</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="n">tempmin</span>
+                    <span class="n">tempmax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="k">if</span> <span class="n">tempmax</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="n">tempmax</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error: wrong value entered: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                    <span class="k">return</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error: wrong value entered: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                <span class="k">return</span>
+            <span class="c">#Check if # of points for theory model are valid(&gt;0).</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">npts</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts</span><span class="p">):</span>
+                    <span class="n">temp_npts</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="k">if</span> <span class="n">temp_npts</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">num_points</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">num_points</span> <span class="o">=</span> <span class="n">temp_npts</span>
+                        <span class="c">#is_modified = True</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Cannot plot: No points in Q range!!!  &quot;</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error: wrong value entered!!!&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_change</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">#Draw the model for a different range</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">create_default_data</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+                   
+    <span class="k">def</span> <span class="nf">_theory_qrange_enter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check validity of value enter in the Q range field</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        
+        <span class="n">tcrtl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="c">#Clear msg if previously shown.</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="c"># Flag to register when a parameter has changed.</span>
+        <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="n">tcrtl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">tcrtl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+
+                <span class="c"># If qmin and qmax have been modified, update qmin and qmax</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">theory_qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">theory_qmax</span><span class="p">):</span>
+                    <span class="n">tempmin</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">theory_qmin</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="k">if</span> <span class="n">tempmin</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">theory_qmin_x</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">theory_qmin_x</span> <span class="o">=</span> <span class="n">tempmin</span>
+                    <span class="n">tempmax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">theory_qmax</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="k">if</span> <span class="n">tempmax</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">theory_qmax_x</span> <span class="o">=</span> <span class="n">tempmax</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error: wrong value entered: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                    <span class="k">return</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error: wrong value entered: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                <span class="k">return</span>
+            <span class="c">#Check if # of points for theory model are valid(&gt;0).</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">IsEditable</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="p">):</span>
+                    <span class="n">temp_npts</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="k">if</span> <span class="n">temp_npts</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">num_points</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">num_points</span> <span class="o">=</span> <span class="n">temp_npts</span>
+                        <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Cannot Plot: No points in Q range!!!  &quot;</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error: wrong value entered!!!&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_change</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">#Draw the model for a different range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">create_default_data</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+                   
+    <span class="k">def</span> <span class="nf">_on_select_model_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        call back for model selection</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## reset dictionary containing reference to dispersion</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">temp_multi_functional</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">f_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="c">#For MAC</span>
+        <span class="n">form_factor</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">f_id</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">form_factor</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">f_id</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">form_factor</span> <span class="ow">in</span>  <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">[</span><span class="s">&quot;multiplication&quot;</span><span class="p">]:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">text2</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">text2</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Show</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">text2</span><span class="o">.</span><span class="n">Show</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">text2</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            
+        <span class="k">if</span> <span class="n">form_factor</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c"># set multifactor for Mutifunctional models</span>
+            <span class="k">if</span> <span class="n">form_factor</span><span class="p">()</span><span class="o">.</span><span class="n">__class__</span> <span class="ow">in</span> \
+                                        <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">[</span><span class="s">&quot;Multi-Functions&quot;</span><span class="p">]:</span>
+                <span class="n">m_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+                <span class="n">multiplicity</span> <span class="o">=</span> <span class="n">form_factor</span><span class="p">()</span><span class="o">.</span><span class="n">multiplicity_info</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_multfactor_combobox</span><span class="p">(</span><span class="n">multiplicity</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_show_multfactor_combobox</span><span class="p">()</span>
+                <span class="c">#ToDo:  this info should be called directly from the model</span>
+                <span class="n">text</span> <span class="o">=</span> <span class="n">form_factor</span><span class="p">()</span><span class="o">.</span><span class="n">multiplicity_info</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>  <span class="c"># &#39;No. of Shells: &#39;</span>
+
+                <span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">m_id</span> <span class="o">&gt;</span> <span class="n">multiplicity</span> <span class="o">-</span> <span class="mi">1</span><span class="p">:</span>
+                    <span class="c"># default value</span>
+                    <span class="n">m_id</span> <span class="o">=</span> <span class="mi">1</span>
+                    
+                <span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">m_id</span><span class="p">)</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span> <span class="o">=</span> <span class="mi">0</span>
+                <span class="n">form_factor</span> <span class="o">=</span> <span class="n">form_factor</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">m_id</span><span class="p">)</span>
+                <span class="c"># Check len of the text1 and max_multiplicity</span>
+                <span class="n">text</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+                <span class="k">if</span> <span class="n">form_factor</span><span class="o">.</span><span class="n">multiplicity_info</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> \
+                                        <span class="nb">len</span><span class="p">(</span><span class="n">form_factor</span><span class="o">.</span><span class="n">multiplicity_info</span><span class="p">[</span><span class="mi">2</span><span class="p">]):</span>
+                    <span class="n">text</span> <span class="o">=</span> <span class="n">form_factor</span><span class="o">.</span><span class="n">multiplicity_info</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span><span class="p">]</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text1</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
+                <span class="c"># Check if model has  get sld profile.</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">form_factor</span><span class="o">.</span><span class="n">multiplicity_info</span><span class="p">[</span><span class="mi">3</span><span class="p">])</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">sld_axes</span> <span class="o">=</span> <span class="n">form_factor</span><span class="o">.</span><span class="n">multiplicity_info</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">show_sld_button</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">sld_axes</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_hide_multfactor_combobox</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">show_sld_button</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                <span class="n">form_factor</span> <span class="o">=</span> <span class="n">form_factor</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_hide_multfactor_combobox</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">show_sld_button</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span> <span class="o">=</span> <span class="bp">None</span>
+              
+        <span class="n">s_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="n">struct_factor</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">s_id</span><span class="p">)</span>
+        
+        <span class="k">if</span>  <span class="n">struct_factor</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="kn">from</span> <span class="nn">sas.models.MultiplicationModel</span> <span class="kn">import</span> <span class="n">MultiplicationModel</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">MultiplicationModel</span><span class="p">(</span><span class="n">form_factor</span><span class="p">,</span> <span class="n">struct_factor</span><span class="p">())</span>
+            <span class="c"># multifunctional form factor</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">form_factor</span><span class="o">.</span><span class="n">non_fittable</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">temp_multi_functional</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">form_factor</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">form_factor</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span>
+        <span class="c"># check if model has magnetic parameters</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_has_magnetic</span> <span class="o">=</span> <span class="bp">True</span> 
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_has_magnetic</span> <span class="o">=</span> <span class="bp">False</span>  
+        <span class="c">## post state to fit panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">parameters</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">multi_factor</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getDispParamList</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disp_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_set_focus</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_validate_qrange</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">qmin_ctrl</span><span class="p">,</span> <span class="n">qmax_ctrl</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Verify that the Q range controls have valid values</span>
+<span class="sd">        and that Qmin &lt; Qmax.</span>
+<span class="sd">        </span>
+<span class="sd">        :param qmin_ctrl: text control for Qmin</span>
+<span class="sd">        :param qmax_ctrl: text control for Qmax</span>
+<span class="sd">        </span>
+<span class="sd">        :return: True is the Q range is value, False otherwise</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">qmin_validity</span> <span class="o">=</span> <span class="n">check_float</span><span class="p">(</span><span class="n">qmin_ctrl</span><span class="p">)</span>
+        <span class="n">qmax_validity</span> <span class="o">=</span> <span class="n">check_float</span><span class="p">(</span><span class="n">qmax_ctrl</span><span class="p">)</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="p">(</span><span class="n">qmin_validity</span> <span class="ow">and</span> <span class="n">qmax_validity</span><span class="p">):</span>
+            <span class="k">return</span> <span class="bp">False</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">qmin</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">qmin_ctrl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="n">qmax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">qmax_ctrl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">if</span> <span class="n">qmin</span> <span class="o">&lt;</span> <span class="n">qmax</span><span class="p">:</span>
+                <span class="c">#Make sure to set both colours white.</span>
+                <span class="n">qmin_ctrl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                <span class="n">qmin_ctrl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="n">qmax_ctrl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                <span class="n">qmax_ctrl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">qmin_ctrl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">qmin_ctrl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="n">qmax_ctrl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">qmax_ctrl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Invalid Q range: Q min must be smaller than Q max&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                <span class="k">return</span> <span class="bp">False</span>
+        <span class="k">return</span> <span class="bp">True</span>
+    
+    <span class="k">def</span> <span class="nf">_validate_Npts</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Validate the number of points for fitting is more than 10 points.</span>
+<span class="sd">        If valid, setvalues Npts_fit otherwise post msg.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#default flag</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c"># Theory</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">flag</span>
+        <span class="k">for</span> <span class="n">data</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_list</span><span class="p">:</span>
+            <span class="c"># q value from qx and qy</span>
+            <span class="n">radius</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">*</span> <span class="n">data</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">+</span>
+                                <span class="n">data</span><span class="o">.</span><span class="n">qy_data</span> <span class="o">*</span> <span class="n">data</span><span class="o">.</span><span class="n">qy_data</span><span class="p">)</span>
+            <span class="c">#get unmasked index</span>
+            <span class="n">index_data</span> <span class="o">=</span> <span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span> <span class="o">&lt;=</span> <span class="n">radius</span><span class="p">)</span> <span class="o">&amp;</span> \
+                            <span class="p">(</span><span class="n">radius</span> <span class="o">&lt;=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()))</span>
+            <span class="n">index_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">index_data</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">mask</span><span class="p">)</span>
+            <span class="n">index_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">index_data</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">data</span><span class="p">))</span>
+
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">index_data</span><span class="p">[</span><span class="n">index_data</span><span class="p">])</span> <span class="o">&lt;</span> <span class="mi">10</span><span class="p">:</span>
+                <span class="c"># change the color pink.</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Data Error: &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Too few points in </span><span class="si">%s</span><span class="s">.&quot;</span> <span class="o">%</span> <span class="n">data</span><span class="o">.</span><span class="n">name</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">index_data</span><span class="p">[</span><span class="n">index_data</span> <span class="o">==</span> <span class="bp">True</span><span class="p">])))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">True</span>
+            
+        <span class="k">return</span> <span class="n">flag</span>
+
+    <span class="k">def</span> <span class="nf">_validate_Npts_1D</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Validate the number of points for fitting is more than 5 points.</span>
+<span class="sd">        If valid, setvalues Npts_fit otherwise post msg.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#default flag</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c"># Theory</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">flag</span>
+        <span class="k">for</span> <span class="n">data</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_list</span><span class="p">:</span>
+            <span class="c"># q value from qx and qy</span>
+            <span class="n">radius</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">x</span>
+            <span class="c">#get unmasked index</span>
+            <span class="n">index_data</span> <span class="o">=</span> <span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span> <span class="o">&lt;=</span> <span class="n">radius</span><span class="p">)</span> <span class="o">&amp;</span> \
+                            <span class="p">(</span><span class="n">radius</span> <span class="o">&lt;=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()))</span>
+            <span class="n">index_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">index_data</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">y</span><span class="p">))</span>
+
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">index_data</span><span class="p">[</span><span class="n">index_data</span><span class="p">])</span> <span class="o">&lt;</span> <span class="mi">5</span><span class="p">:</span>
+                <span class="c"># change the color pink.</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Data Error: &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Too few points in </span><span class="si">%s</span><span class="s">.&quot;</span> <span class="o">%</span> <span class="n">data</span><span class="o">.</span><span class="n">name</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">index_data</span><span class="p">[</span><span class="n">index_data</span> <span class="o">==</span> <span class="bp">True</span><span class="p">])))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">True</span>
+            
+        <span class="k">return</span> <span class="n">flag</span>
+    
+    <span class="k">def</span> <span class="nf">_check_value_enter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">list</span><span class="p">,</span> <span class="n">modified</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :param list: model parameter and panel info</span>
+<span class="sd">        :Note: each item of the list should be as follow:</span>
+<span class="sd">            item=[check button state, parameter&#39;s name,</span>
+<span class="sd">                paramater&#39;s value, string=&quot;+/-&quot;,</span>
+<span class="sd">                parameter&#39;s error of fit,</span>
+<span class="sd">                parameter&#39;s minimum value,</span>
+<span class="sd">                parrameter&#39;s maximum value ,</span>
+<span class="sd">                parameter&#39;s units]</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">is_modified</span> <span class="o">=</span> <span class="n">modified</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">is_modified</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">:</span>
+            <span class="c">#skip angle parameters for 1D</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                    <span class="k">continue</span>
+            <span class="c">#try:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+            
+            <span class="k">if</span> <span class="n">string</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="s">&quot;.npts&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span> <span class="ow">and</span> \
+                                        <span class="n">string</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="s">&quot;.nsigmas&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+                <span class="c">## check model parameters range</span>
+                <span class="n">param_min</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">param_max</span> <span class="o">=</span> <span class="bp">None</span>
+               
+                <span class="c">## check minimun value</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="n">param_min</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">],</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]):</span>
+                                <span class="k">if</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">param_min</span><span class="p">):</span>
+                                    <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">param_min</span><span class="p">))</span>
+                            
+                            <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                            <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                                           
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Wrong fit parameter range entered&quot;</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">msg</span>
+                        <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="c">## check maximum value</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="n">param_max</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]):</span>
+                                <span class="k">if</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">param_max</span><span class="p">):</span>
+                                    <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">param_max</span><span class="p">))</span>
+                            
+                            <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                            <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Wrong Fit parameter range entered &quot;</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">msg</span>
+                        <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">True</span>
+                
+                <span class="k">if</span> <span class="n">param_min</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">param_max</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">],</span> <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]):</span>
+                        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Wrong Fit range entered for parameter &quot;</span>
+                        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;name </span><span class="si">%s</span><span class="s"> of model </span><span class="si">%s</span><span class="s"> &quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                
+                <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">:</span><span class="mi">3</span><span class="p">]</span> <span class="o">=</span> <span class="n">param_min</span><span class="p">,</span> <span class="n">param_max</span>
+                    <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="n">param_min</span><span class="p">,</span> <span class="n">param_max</span><span class="p">]</span>
+                    <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">True</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="c"># Check if the textctr is enabled</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+                    <span class="n">value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+                    <span class="c"># If the value of the parameter has changed,</span>
+                    <span class="c"># +update the model and set the is_modified flag</span>
+                    <span class="k">if</span> <span class="n">value</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> <span class="ow">and</span> \
+                                                <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">value</span><span class="p">):</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Wrong Fit parameter value entered &quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                
+        <span class="k">return</span> <span class="n">is_modified</span>
+        
+    <span class="k">def</span> <span class="nf">_set_dipers_Param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        respond to self.enable_disp and self.disable_disp radio box.</span>
+<span class="sd">        The dispersity object is reset inside the model into Gaussian.</span>
+<span class="sd">        When the user select yes , this method display a combo box for</span>
+<span class="sd">        more selection when the user selects No,the combo box disappears.</span>
+<span class="sd">        Redraw the model with the default dispersity (Gaussian)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## On selction if no model exists.</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please select a Model first...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Polydispersion: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">msg</span><span class="p">))</span>
+            <span class="k">return</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_dispersity</span><span class="p">()</span>
+    
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_disp</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">return</span>
+
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="c">## layout for model containing no dispersity parameters</span>
+            
+            <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getDispParamList</span><span class="p">()</span>
+             
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_layout_sizer_noDipers</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="c">## set gaussian sizer</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_Disp</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            
+        <span class="c">## post state to fit panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        <span class="c">#draw the model with the current dispersity</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer5</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+          
+    <span class="k">def</span> <span class="nf">_layout_sizer_noDipers</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw a sizer with no dispersity info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span> <span class="o">=</span> <span class="p">[]</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="s">&quot;No polydispersity available for this model&quot;</span>
+        <span class="n">model_disp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">model_disp</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                          <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+    
+    <span class="k">def</span> <span class="nf">_reset_dispersity</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        put gaussian dispersity into current model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+         
+        <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">values</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weights</span> <span class="o">=</span> <span class="p">{}</span>
+      
+        <span class="kn">from</span> <span class="nn">sas.models.dispersion_models</span> <span class="kn">import</span> <span class="n">GaussianDispersion</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">):</span>
+            <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">:</span>
+                <span class="c"># The parameter was un-selected.</span>
+                <span class="c"># Go back to Gaussian model (with 0 pts)</span>
+                <span class="n">disp_model</span> <span class="o">=</span> <span class="n">GaussianDispersion</span><span class="p">()</span>
+               
+                <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">p</span><span class="p">]</span> <span class="o">=</span> <span class="n">disp_model</span>
+                <span class="c"># Set the new model as the dispersion object</span>
+                <span class="c"># for the selected parameter</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_dispersion</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">disp_model</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+
+                    <span class="k">pass</span>
+
+        <span class="c">## save state into</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                  
+    <span class="k">def</span> <span class="nf">_on_select_Disp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        allow selecting different dispersion</span>
+<span class="sd">        self.disp_list should change type later .now only gaussian</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_sizer_dispersion</span><span class="p">()</span>
+
+        <span class="c">## Redraw the model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+        <span class="c">#self._undo.Enable(True)</span>
+        <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+    
+    <span class="k">def</span> <span class="nf">_on_disp_func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Select a distribution function for the polydispersion</span>
+<span class="sd">        </span>
+<span class="sd">        :Param event: ComboBox event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get ready for new event</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="c"># Get event object</span>
+        <span class="n">disp_box</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+
+        <span class="c"># Try to select a Distr. function</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">disp_box</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+            <span class="n">selection</span> <span class="o">=</span> <span class="n">disp_box</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+            <span class="n">param_name</span> <span class="o">=</span> <span class="n">disp_box</span><span class="o">.</span><span class="n">Name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="n">disp_name</span> <span class="o">=</span> <span class="n">disp_box</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="n">dispersity</span> <span class="o">=</span> <span class="n">disp_box</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">selection</span><span class="p">)</span>
+    
+            <span class="c">#disp_model =  GaussianDispersion()</span>
+            <span class="n">disp_model</span> <span class="o">=</span> <span class="n">dispersity</span><span class="p">()</span>
+            <span class="c"># Get param names to reset the values of the param</span>
+            <span class="n">name1</span> <span class="o">=</span> <span class="n">param_name</span> <span class="o">+</span> <span class="s">&quot;.width&quot;</span>
+            <span class="n">name2</span> <span class="o">=</span> <span class="n">param_name</span> <span class="o">+</span> <span class="s">&quot;.npts&quot;</span>
+            <span class="n">name3</span> <span class="o">=</span> <span class="n">param_name</span> <span class="o">+</span> <span class="s">&quot;.nsigmas&quot;</span>
+            <span class="c"># Check Disp. function whether or not it is &#39;array&#39;</span>
+            <span class="k">if</span> <span class="n">disp_name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;array&quot;</span><span class="p">:</span>
+                <span class="n">value2</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+                <span class="n">value3</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+                <span class="n">value1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_array_disp</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">name1</span><span class="p">,</span> <span class="n">disp</span><span class="o">=</span><span class="n">disp_model</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_del_array_values</span><span class="p">(</span><span class="n">name1</span><span class="p">)</span>
+                <span class="c">#self._reset_array_disp(param_name)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">name1</span><span class="p">]</span> <span class="o">=</span> <span class="n">disp_model</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_dispersion</span><span class="p">(</span><span class="n">param_name</span><span class="p">,</span> <span class="n">disp_model</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">name1</span><span class="p">]</span> <span class="o">=</span> <span class="n">disp_model</span>
+ 
+                <span class="n">value1</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">name1</span><span class="p">),</span> <span class="bp">True</span><span class="p">))</span>
+                <span class="n">value2</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">name2</span><span class="p">)))</span>
+                <span class="n">value3</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">name3</span><span class="p">)))</span>
+            <span class="c"># Reset fittable polydispersin parameter value</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="n">name1</span><span class="p">:</span>
+                    <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">value1</span><span class="p">)</span>
+                    <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+                    <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+                    <span class="c"># Disable for array</span>
+                    <span class="k">if</span> <span class="n">disp_name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;array&quot;</span><span class="p">:</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+                    <span class="k">break</span>
+            <span class="c"># Reset fixed polydispersion params</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="n">name2</span><span class="p">:</span>
+                    <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">value2</span><span class="p">)</span> 
+                    <span class="c"># Disable Npts for array</span>
+                    <span class="k">if</span> <span class="n">disp_name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;array&quot;</span><span class="p">:</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="n">name3</span><span class="p">:</span>
+                    <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">value3</span><span class="p">)</span>
+                    <span class="c"># Disable Nsigs for array</span>
+                    <span class="k">if</span> <span class="n">disp_name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;array&quot;</span><span class="p">:</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+                
+            <span class="c"># Make sure the check box updated when all checked</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="c">#self.select_all_param(None)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">get_all_checked_params</span><span class="p">()</span>
+
+            <span class="c"># update params</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_update_paramv_on_fit</span><span class="p">()</span>
+            <span class="c"># draw</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c"># Error msg</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error occurred:&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; Could not select the distribution function...&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; Please select another distribution function.&quot;</span>
+            <span class="n">disp_box</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="c"># Focus on Fit button so that users can see the pinky box</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">_set_array_disp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">disp</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set array dispersion</span>
+<span class="sd">        </span>
+<span class="sd">        :param name: name of the parameter for the dispersion to be set</span>
+<span class="sd">        :param disp: the polydisperion object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># The user wants this parameter to be averaged.</span>
+        <span class="c"># Pop up the file selection dialog.</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_selectDlg</span><span class="p">()</span>
+        <span class="c"># Array data</span>
+        <span class="n">values</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">weights</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># If nothing was selected, just return</span>
+        <span class="k">if</span> <span class="n">path</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="c">#self.noDisper_rbox.SetValue(True)</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span>\
+                             <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span>
+
+        <span class="n">basename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">values</span><span class="p">,</span> <span class="n">weights</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">read_file</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        
+        <span class="c"># If any of the two arrays is empty, notify the user that we won&#39;t</span>
+        <span class="c"># proceed</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+
+        <span class="c"># Tell the user that we are about to apply the distribution</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Applying loaded </span><span class="si">%s</span><span class="s"> distribution: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">path</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_array_disp_model</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span> <span class="n">disp</span><span class="o">=</span><span class="n">disp</span><span class="p">,</span>
+                                    <span class="n">values</span><span class="o">=</span><span class="n">values</span><span class="p">,</span> <span class="n">weights</span><span class="o">=</span><span class="n">weights</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">basename</span>
+    
+    <span class="k">def</span> <span class="nf">_set_array_disp_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">disp</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                              <span class="n">values</span><span class="o">=</span><span class="p">[],</span> <span class="n">weights</span><span class="o">=</span><span class="p">[]):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set array dispersion model</span>
+<span class="sd">        </span>
+<span class="sd">        :param name: name of the parameter for the dispersion to be set</span>
+<span class="sd">        :param disp: the polydisperion object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">disp</span><span class="o">.</span><span class="n">set_weights</span><span class="p">(</span><span class="n">values</span><span class="p">,</span> <span class="n">weights</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">disp</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_dispersion</span><span class="p">(</span><span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">],</span> <span class="n">disp</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">disp</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">values</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weights</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">weights</span>
+        <span class="c"># Store the object to make it persist outside the</span>
+        <span class="c"># scope of this method</span>
+        <span class="c">#TODO: refactor model to clean this up?</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">values</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">weights</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">values</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="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">weights</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="bp">self</span><span class="o">.</span><span class="n">weights</span><span class="p">)</span>
+
+        <span class="c"># Set the new model as the dispersion object for the</span>
+        <span class="c">#selected parameter</span>
+        <span class="c">#self.model.set_dispersion(p, disp_model)</span>
+        <span class="c"># Store a reference to the weights in the model object</span>
+        <span class="c">#so that</span>
+        <span class="c"># it&#39;s not lost when we use the model within another thread.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">_persistency_dict</span><span class="p">[</span><span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]]</span> <span class="o">=</span> \
+                                        <span class="p">[</span><span class="n">values</span><span class="p">,</span> <span class="n">weights</span><span class="p">]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">_persistency_dict</span><span class="p">[</span><span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]]</span> <span class="o">=</span> \
+                                        <span class="p">[</span><span class="n">values</span><span class="p">,</span> <span class="n">weights</span><span class="p">]</span>
+                                        
+    <span class="k">def</span> <span class="nf">_del_array_values</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Reset array dispersion</span>
+<span class="sd">        </span>
+<span class="sd">        :param name: name of the parameter for the dispersion to be set</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Try to delete values and weight of the names array dic if exists</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
+            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">weights</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
+            <span class="c"># delete all other dic</span>
+            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">values</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
+            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">weights</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
+            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">_persistency_dict</span><span class="p">[</span><span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]]</span>
+            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">_persistency_dict</span><span class="p">[</span><span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]]</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+                                            
+    <span class="k">def</span> <span class="nf">_lay_out</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        returns self.Layout</span>
+<span class="sd">        </span>
+<span class="sd">        :Note: Mac seems to like this better when self.</span>
+<span class="sd">            Layout is called after fitting.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sleep4sec</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="k">return</span>
+    
+    <span class="k">def</span> <span class="nf">_sleep4sec</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            sleep for 1 sec only applied on Mac</span>
+<span class="sd">            Note: This 1sec helps for Mac not to crash on self.</span>
+<span class="sd">            Layout after self._draw_model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">ON_MAC</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
+            
+    <span class="k">def</span> <span class="nf">_find_polyfunc_selection</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">disp_func</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        FInd Comboox selection from disp_func</span>
+<span class="sd">        </span>
+<span class="sd">        :param disp_function: dispersion distr. function</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># List of the poly_model name in the combobox</span>
+        <span class="nb">list</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;RectangleDispersion&quot;</span><span class="p">,</span> <span class="s">&quot;ArrayDispersion&quot;</span><span class="p">,</span>
+                <span class="s">&quot;LogNormalDispersion&quot;</span><span class="p">,</span> <span class="s">&quot;GaussianDispersion&quot;</span><span class="p">,</span>
+                <span class="s">&quot;SchulzDispersion&quot;</span><span class="p">]</span>
+
+        <span class="c"># Find the selection</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">selection</span> <span class="o">=</span> <span class="nb">list</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">disp_func</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+            <span class="k">return</span> <span class="n">selection</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">return</span> <span class="mi">3</span>
+                            
+<div class="viewcode-block" id="BasicPage.on_reset_clicked"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_reset_clicked">[docs]</a>    <span class="k">def</span> <span class="nf">on_reset_clicked</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On &#39;Reset&#39; button  for Q range clicked</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c">##For 3 different cases: Data2D, Data1D, and theory</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please select a model first...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="k">return</span>
+            
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+            <span class="n">data_min</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="n">x</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xmin</span><span class="p">),</span> <span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xmax</span><span class="p">))</span>
+            <span class="n">y</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">ymin</span><span class="p">),</span> <span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">ymax</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="n">data_min</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">x</span><span class="o">*</span><span class="n">x</span> <span class="o">+</span> <span class="n">y</span><span class="o">*</span><span class="n">y</span><span class="p">)</span>
+            <span class="c">#self.data.mask = numpy.ones(len(self.data.data),dtype=bool)</span>
+            <span class="c"># check smearing</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="c">## set smearing value whether or</span>
+                <span class="c"># not the data contain the smearing info</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">update_pinhole_smear</span><span class="p">()</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+                    
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="n">_QMIN_DEFAULT</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="n">_QMAX_DEFAULT</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">num_points</span> <span class="o">=</span> <span class="n">_NPTS_DEFAULT</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">npts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">num_points</span>
+            
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+            <span class="c"># check smearing</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="c">## set smearing value whether or</span>
+                <span class="c"># not the data contain the smearing info</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">update_slit_smear</span><span class="p">()</span>
+                <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">update_pinhole_smear</span><span class="p">()</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            
+        <span class="k">if</span> <span class="n">flag</span> <span class="o">==</span> <span class="bp">False</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Cannot Plot :Must enter a number!!!  &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># set relative text ctrs.</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">show_npts2fit</span><span class="p">()</span>
+            <span class="c"># At this point, some button and variables satatus (disabled?)</span>
+            <span class="c"># should be checked such as color that should be reset to</span>
+            <span class="c"># white in case that it was pink.</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_onparamEnter_helper</span><span class="p">()</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span>
+        
+        <span class="c">#reset the q range values</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_plotting_range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.select_log"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.select_log">[docs]</a>    <span class="k">def</span> <span class="nf">select_log</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Log checked to generate log spaced points for theory model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+</div>
+<div class="viewcode-block" id="BasicPage.get_images"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_images">[docs]</a>    <span class="k">def</span> <span class="nf">get_images</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the images of the plots corresponding this panel for report</span>
+<span class="sd">        </span>
+<span class="sd">        : return graphs: list of figures</span>
+<span class="sd">        : Need Move to guiframe</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># set list of graphs</span>
+        <span class="n">graphs</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">canvases</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">res_item</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># call gui_manager</span>
+        <span class="n">gui_manager</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span>
+        <span class="c"># loops through the panels [dic]</span>
+        <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">item2</span> <span class="ow">in</span> <span class="n">gui_manager</span><span class="o">.</span><span class="n">plot_panels</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">data_title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+            <span class="c"># try to get all plots belonging to this control panel</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">g_id</span> <span class="o">=</span> <span class="n">item2</span><span class="o">.</span><span class="n">group_id</span>
+                <span class="k">if</span> <span class="n">g_id</span> <span class="o">==</span> <span class="n">data_title</span> <span class="ow">or</span> \
+                        <span class="nb">str</span><span class="p">(</span><span class="n">g_id</span><span class="p">)</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;res&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span><span class="p">))</span> <span class="ow">or</span> \
+                        <span class="nb">str</span><span class="p">(</span><span class="n">g_id</span><span class="p">)</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">))</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">g_id</span><span class="p">)</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;res&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span><span class="p">))</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">res_item</span> <span class="o">=</span> <span class="p">[</span><span class="n">item2</span><span class="o">.</span><span class="n">figure</span><span class="p">,</span> <span class="n">item2</span><span class="o">.</span><span class="n">canvas</span><span class="p">]</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="c"># append to the list</span>
+                        <span class="n">graphs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item2</span><span class="o">.</span><span class="n">figure</span><span class="p">)</span>
+                        <span class="n">canvases</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item2</span><span class="o">.</span><span class="n">canvas</span><span class="p">)</span>  
+            <span class="k">except</span><span class="p">:</span>
+                <span class="c"># Not for control panels</span>
+                <span class="k">pass</span>
+        <span class="c"># Make sure the resduals plot goes to the last</span>
+        <span class="k">if</span> <span class="n">res_item</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">graphs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">res_item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="n">canvases</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">res_item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="c"># return the list of graphs</span>
+        <span class="k">return</span> <span class="n">graphs</span><span class="p">,</span> <span class="n">canvases</span>
+</div>
+<div class="viewcode-block" id="BasicPage.on_model_help_clicked"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_model_help_clicked">[docs]</a>    <span class="k">def</span> <span class="nf">on_model_help_clicked</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        on &#39;More details&#39; button</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">sas.perspectives.fitting.help_panel</span> <span class="kn">import</span>  <span class="n">HelpWindow</span>
+        <span class="kn">from</span> <span class="nn">sas.models</span> <span class="kn">import</span> <span class="n">get_data_path</span>
+        
+        <span class="c"># Get models help model_function path</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&#39;media&#39;</span><span class="p">)</span>
+        <span class="n">model_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="s">&quot;model_functions.html&quot;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="s">&#39;FuncHelp&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">HelpWindow</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">pageToOpen</span><span class="o">=</span><span class="n">model_path</span><span class="p">)</span>
+        <span class="c"># If model name exists and model is not a custom model</span>
+        <span class="c">#mod_cat = self.categorybox.GetStringSelection()</span>
+        <span class="k">if</span> <span class="n">frame</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">HasAnchor</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">ScrollToAnchor</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">frame</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;Model description:</span><span class="se">\n</span><span class="s">&#39;</span>
+                <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">description</span><span class="p">)</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Sorry, no information is available for this model.&quot;</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">description</span> <span class="o">+</span> <span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span>
+                <span class="n">info</span> <span class="o">=</span> <span class="s">&quot;Info&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+</div>
+    <span class="k">def</span> <span class="nf">_on_mag_help</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>    
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Magnetic angles help panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">sas.perspectives.fitting.help_panel</span> <span class="kn">import</span>  <span class="n">HelpWindow</span>
+        <span class="c"># Get models help model_function path</span>
+        <span class="c">#import sas.perspectives.fitting as fitmedia</span>
+        <span class="kn">from</span> <span class="nn">sas.models</span> <span class="kn">import</span> <span class="n">get_data_path</span>
+
+        <span class="n">media</span> <span class="o">=</span> <span class="n">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&#39;media&#39;</span><span class="p">)</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">media</span><span class="p">,</span> <span class="s">&quot;mag_pic.html&quot;</span><span class="p">)</span> 
+        <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;Polar/Magnetic Angles&quot;</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">HelpWindow</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>  
+                           <span class="n">title</span><span class="o">=</span><span class="s">&#39; Help: Polarization/Magnetization Angles&#39;</span><span class="p">,</span>  
+                           <span class="n">pageToOpen</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">865</span><span class="p">,</span> <span class="mi">450</span><span class="p">))</span>   
+        <span class="k">try</span><span class="p">:</span> 
+            <span class="n">frame</span><span class="o">.</span><span class="n">splitter</span><span class="o">.</span><span class="n">DetachWindow</span><span class="p">(</span><span class="n">frame</span><span class="o">.</span><span class="n">lpanel</span><span class="p">)</span>
+            <span class="c"># Display only the right side one</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">lpanel</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span> 
+            <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">frame</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span> 
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;Display Error</span><span class="se">\n</span><span class="s">&#39;</span>
+            <span class="n">info</span> <span class="o">=</span> <span class="s">&quot;Info&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">_on_mag_on</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>    
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Magnetic Parameters ON/OFF</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">button</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+
+        <span class="k">if</span> <span class="n">button</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;ON&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span> <span class="o">=</span> <span class="bp">True</span>
+            <span class="n">button</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;Magnetic OFF&quot;</span><span class="p">)</span>
+            <span class="n">m_value</span> <span class="o">=</span> <span class="mf">1.0e-06</span>
+            <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">key</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;M0&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">m_value</span><span class="p">)</span>
+                    <span class="n">m_value</span> <span class="o">+=</span> <span class="mf">0.5e-06</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="n">button</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;Magnetic ON&quot;</span><span class="p">)</span>
+            <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">key</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;M0&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="c">#reset mag value to zero fo safety</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">)</span>
+                    
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>    
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_model_param_sizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+        <span class="c">#self._set_sizer_dispersion() </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">magnetic_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            
+<div class="viewcode-block" id="BasicPage.on_pd_help_clicked"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_pd_help_clicked">[docs]</a>    <span class="k">def</span> <span class="nf">on_pd_help_clicked</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Button event for PD help</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">help_panel</span> <span class="kn">import</span>  <span class="n">HelpWindow</span>
+        <span class="kn">import</span> <span class="nn">sas.models</span> <span class="kn">as</span> <span class="nn">models</span>
+        
+        <span class="c"># Get models help model_function path</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&#39;media&#39;</span><span class="p">)</span>
+        <span class="n">pd_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="s">&quot;pd_help.html&quot;</span><span class="p">)</span>
+
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">HelpWindow</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">pageToOpen</span><span class="o">=</span><span class="n">pd_path</span><span class="p">)</span>
+        <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.on_left_down"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_left_down">[docs]</a>    <span class="k">def</span> <span class="nf">on_left_down</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get key stroke event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Figuring out key combo: Cmd for copy, Alt for paste</span>
+        <span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">CmdDown</span><span class="p">()</span> <span class="ow">and</span> <span class="n">event</span><span class="o">.</span><span class="n">ShiftDown</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_paste</span><span class="p">()</span>
+        <span class="k">elif</span> <span class="n">event</span><span class="o">.</span><span class="n">CmdDown</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_copy</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            <span class="k">return</span>
+        <span class="c"># make event free</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.get_copy"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_copy">[docs]</a>    <span class="k">def</span> <span class="nf">get_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get copy params to clipboard</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_copy_params</span><span class="p">()</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_clipboard</span><span class="p">(</span><span class="n">content</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_info</span><span class="p">(</span><span class="n">flag</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">flag</span>
+            </div>
+<div class="viewcode-block" id="BasicPage.get_copy_params"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_copy_params">[docs]</a>    <span class="k">def</span> <span class="nf">get_copy_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the string copies of the param names and values in the tap</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="s">&#39;sasview_parameter_values:&#39;</span>
+        <span class="c"># Do it if params exist</span>
+        <span class="k">if</span>  <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span> <span class="o">!=</span> <span class="p">[]:</span>
+            
+            <span class="c"># go through the parameters</span>
+            <span class="n">strings</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_copy_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">,</span>
+                                           <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">)</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="n">strings</span>
+            
+            <span class="c"># go through the fittables</span>
+            <span class="n">strings</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_copy_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">,</span>
+                                           <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">)</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="n">strings</span>
+
+            <span class="c"># go through the fixed params</span>
+            <span class="n">strings</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_copy_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">,</span>
+                                           <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">)</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="n">strings</span>
+                
+            <span class="c"># go through the str params</span>
+            <span class="n">strings</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_copy_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">,</span>
+                                           <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">)</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="n">strings</span>
+            <span class="k">return</span> <span class="n">content</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">False</span>
+</div>
+<div class="viewcode-block" id="BasicPage.get_copy_excel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_copy_excel">[docs]</a>    <span class="k">def</span> <span class="nf">get_copy_excel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get copy params to clipboard</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_copy_params_excel</span><span class="p">()</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_clipboard</span><span class="p">(</span><span class="n">content</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_info</span><span class="p">(</span><span class="n">flag</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">flag</span>
+</div>
+<div class="viewcode-block" id="BasicPage.get_copy_params_excel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_copy_params_excel">[docs]</a>    <span class="k">def</span> <span class="nf">get_copy_params_excel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the string copies of the param names and values in the tap</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+
+        <span class="n">crlf</span> <span class="o">=</span> <span class="nb">chr</span><span class="p">(</span><span class="mi">13</span><span class="p">)</span> <span class="o">+</span> <span class="nb">chr</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">tab</span> <span class="o">=</span> <span class="nb">chr</span><span class="p">(</span><span class="mi">9</span><span class="p">)</span>
+
+        <span class="c"># Do it if params exist</span>
+        <span class="k">if</span>  <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span> <span class="o">!=</span> <span class="p">[]:</span>
+
+            <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="n">param</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="c">#parameter name</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="n">tab</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="n">param</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">+</span><span class="s">&quot;_err&quot;</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="n">tab</span>
+
+            <span class="n">content</span> <span class="o">+=</span> <span class="n">crlf</span>
+
+            <span class="c">#row of values and errors...</span>
+            <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="n">param</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="c">#value</span>
+                <span class="n">content</span> <span class="o">+=</span><span class="n">tab</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="n">param</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="c">#error</span>
+                <span class="n">content</span> <span class="o">+=</span><span class="n">tab</span>
+
+            <span class="k">return</span> <span class="n">content</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">False</span>
+
+</div>
+<div class="viewcode-block" id="BasicPage.get_copy_latex"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_copy_latex">[docs]</a>    <span class="k">def</span> <span class="nf">get_copy_latex</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get copy params to clipboard</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_copy_params_latex</span><span class="p">()</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_clipboard</span><span class="p">(</span><span class="n">content</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_info</span><span class="p">(</span><span class="n">flag</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">flag</span>
+</div>
+<div class="viewcode-block" id="BasicPage.get_copy_params_latex"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_copy_params_latex">[docs]</a>    <span class="k">def</span> <span class="nf">get_copy_params_latex</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the string copies of the param names and values in the tap</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="s">&#39;</span><span class="se">\\</span><span class="s">begin{table}&#39;</span>
+        <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39;</span><span class="se">\\</span><span class="s">begin{tabular}[h]&#39;</span>
+
+        <span class="n">crlf</span> <span class="o">=</span> <span class="nb">chr</span><span class="p">(</span><span class="mi">13</span><span class="p">)</span> <span class="o">+</span> <span class="nb">chr</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">tab</span> <span class="o">=</span> <span class="nb">chr</span><span class="p">(</span><span class="mi">9</span><span class="p">)</span>
+
+        <span class="c"># Do it if params exist</span>
+        <span class="k">if</span>  <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span> <span class="o">!=</span> <span class="p">[]:</span>
+
+            <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39;{|&#39;</span>
+            <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39;l|l|&#39;</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39;}\hline&#39;</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="n">crlf</span>
+
+            <span class="k">for</span> <span class="n">index</span><span class="p">,</span> <span class="n">param</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">):</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="n">param</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">replace</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> <span class="c">#parameter name</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39; &amp; &#39;</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="n">param</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">replace</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><span class="o">+</span><span class="s">&quot;\_err&quot;</span>
+                <span class="k">if</span> <span class="n">index</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+                    <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39; &amp; &#39;</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39;</span><span class="se">\\\\</span><span class="s"> </span><span class="se">\\</span><span class="s">hline&#39;</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="n">crlf</span>
+
+            <span class="c">#row of values and errors...</span>
+            <span class="k">for</span> <span class="n">index</span><span class="p">,</span> <span class="n">param</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">):</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="n">param</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="c">#parameter value</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39; &amp; &#39;</span>
+                <span class="n">content</span> <span class="o">+=</span> <span class="n">param</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="c">#parameter error</span>
+                <span class="k">if</span> <span class="n">index</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+                    <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39; &amp; &#39;</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39;</span><span class="se">\\\\</span><span class="s"> </span><span class="se">\\</span><span class="s">hline&#39;</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="n">crlf</span>
+
+            <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39;</span><span class="se">\\</span><span class="s">end{tabular}&#39;</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="s">&#39;</span><span class="se">\\</span><span class="s">end{table}&#39;</span>
+            <span class="k">return</span> <span class="n">content</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">False</span>
+
+</div>
+<div class="viewcode-block" id="BasicPage.set_clipboard"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.set_clipboard">[docs]</a>    <span class="k">def</span> <span class="nf">set_clipboard</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">content</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Put the string to the clipboard</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">content</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="n">wx</span><span class="o">.</span><span class="n">TheClipboard</span><span class="o">.</span><span class="n">Open</span><span class="p">():</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">TheClipboard</span><span class="o">.</span><span class="n">SetData</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">TextDataObject</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">content</span><span class="p">)))</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">TheClipboard</span><span class="o">.</span><span class="n">Close</span><span class="p">()</span>
+            <span class="k">return</span> <span class="bp">True</span>
+        <span class="k">return</span> <span class="bp">None</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_get_copy_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">param</span><span class="p">,</span> <span class="n">orient_param</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Helping get value and name of the params</span>
+<span class="sd">        </span>
+<span class="sd">        : param param:  parameters</span>
+<span class="sd">        : param orient_param = oritational params</span>
+<span class="sd">        : return content: strings [list] [name,value:....]</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="c"># go through the str params</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">param</span><span class="p">:</span>
+            <span class="c"># copy only the params shown</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                <span class="k">continue</span>
+            <span class="n">disfunc</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;ComboBox&#39;</span><span class="p">:</span>
+                    <span class="n">disfunc</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+            
+            <span class="c"># 2D</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">check</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">check</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="c"># 1D</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="c">## for 1D all parameters except orientation</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">in</span> <span class="n">orient_param</span><span class="p">:</span>
+                    <span class="k">try</span><span class="p">:</span>
+                        <span class="n">check</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+                    <span class="k">except</span><span class="p">:</span>
+                        <span class="n">check</span> <span class="o">=</span> <span class="bp">None</span>
+                    <span class="n">name</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                    <span class="n">value</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+
+            <span class="c"># add to the content</span>
+            <span class="k">if</span> <span class="n">disfunc</span> <span class="o">!=</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                
+                <span class="n">disfunc</span> <span class="o">=</span> <span class="s">&#39;,&#39;</span> <span class="o">+</span> <span class="n">disfunc</span>
+            <span class="c"># Need to support array func for copy/paste</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">disfunc</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;array&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="n">disfunc</span> <span class="o">+=</span> <span class="s">&#39;,&#39;</span>
+                    <span class="k">for</span> <span class="n">val</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">[</span><span class="n">name</span><span class="p">]:</span>
+                        <span class="n">disfunc</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">val</span><span class="p">)</span>
+                    <span class="n">disfunc</span> <span class="o">+=</span> <span class="s">&#39;,&#39;</span>
+                    <span class="k">for</span> <span class="n">weight</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">weights</span><span class="p">[</span><span class="n">name</span><span class="p">]:</span>
+                        <span class="n">disfunc</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">weight</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+            <span class="n">content</span> <span class="o">+=</span> <span class="n">name</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">check</span><span class="p">)</span> <span class="o">+</span> <span class="s">&#39;,&#39;</span> <span class="o">+</span> <span class="n">value</span> <span class="o">+</span> <span class="n">disfunc</span> <span class="o">+</span> <span class="s">&#39;:&#39;</span>
+
+        <span class="k">return</span> <span class="n">content</span>
+   
+<div class="viewcode-block" id="BasicPage.get_clipboard"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_clipboard">[docs]</a>    <span class="k">def</span> <span class="nf">get_clipboard</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get strings in the clipboard</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="c"># Get text from the clip board</span>
+        <span class="k">if</span> <span class="n">wx</span><span class="o">.</span><span class="n">TheClipboard</span><span class="o">.</span><span class="n">Open</span><span class="p">():</span>
+            <span class="k">if</span> <span class="n">wx</span><span class="o">.</span><span class="n">TheClipboard</span><span class="o">.</span><span class="n">IsSupported</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">DataFormat</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">DF_TEXT</span><span class="p">)):</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">TextDataObject</span><span class="p">()</span>
+                <span class="c"># get wx dataobject</span>
+                <span class="n">success</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">TheClipboard</span><span class="o">.</span><span class="n">GetData</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+                <span class="c"># get text</span>
+                <span class="k">if</span> <span class="n">success</span><span class="p">:</span>
+                    <span class="n">text</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">GetText</span><span class="p">()</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">text</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+            <span class="c"># close clipboard</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">TheClipboard</span><span class="o">.</span><span class="n">Close</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">text</span>
+    </div>
+<div class="viewcode-block" id="BasicPage.get_paste"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_paste">[docs]</a>    <span class="k">def</span> <span class="nf">get_paste</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Paste params from the clipboard</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_clipboard</span><span class="p">()</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_paste_params</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_info</span><span class="p">(</span><span class="n">flag</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">flag</span>
+        </div>
+<div class="viewcode-block" id="BasicPage.get_paste_params"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_paste_params">[docs]</a>    <span class="k">def</span> <span class="nf">get_paste_params</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the string copies of the param names and values in the tap</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">context</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c"># put the text into dictionary</span>
+        <span class="n">lines</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;:&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">lines</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&#39;sasview_parameter_values&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_copy_info</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="k">return</span> <span class="bp">False</span>
+        <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">[</span><span class="mi">1</span><span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">]:</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">line</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">item</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;,&#39;</span><span class="p">)</span>
+                <span class="n">check</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
+                <span class="c"># Transfer the text to content[dictionary]</span>
+                <span class="n">context</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="n">check</span><span class="p">,</span> <span class="n">value</span><span class="p">]</span>
+            <span class="c"># ToDo: PlugIn this poly disp function for pasting</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">poly_func</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span>
+                <span class="n">context</span><span class="p">[</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">poly_func</span><span class="p">)</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="c"># take the vals and weights for  array</span>
+                    <span class="n">array_values</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">4</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>
+                    <span class="n">array_weights</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">5</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>
+                    <span class="n">val</span> <span class="o">=</span> <span class="p">[</span><span class="nb">float</span><span class="p">(</span><span class="n">a_val</span><span class="p">)</span> <span class="k">for</span> <span class="n">a_val</span> <span class="ow">in</span> <span class="n">array_values</span><span class="p">[</span><span class="mi">1</span><span class="p">:]]</span>
+                    <span class="n">weit</span> <span class="o">=</span> <span class="p">[</span><span class="nb">float</span><span class="p">(</span><span class="n">a_weit</span><span class="p">)</span> <span class="k">for</span> <span class="n">a_weit</span> <span class="ow">in</span> <span class="n">array_weights</span><span class="p">[</span><span class="mi">1</span><span class="p">:]]</span>
+                    
+                    <span class="n">context</span><span class="p">[</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+                    <span class="n">context</span><span class="p">[</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">weit</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">raise</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">poly_func</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+                <span class="n">context</span><span class="p">[</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">poly_func</span><span class="p">)</span>
+
+        <span class="c"># Do it if params exist</span>
+        <span class="k">if</span>  <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span> <span class="o">!=</span> <span class="p">[]:</span>
+            <span class="c"># go through the parameters</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_get_paste_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">,</span>
+                                   <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span>
+
+            <span class="c"># go through the fittables</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_get_paste_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">,</span>
+                                   <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">,</span>
+                                   <span class="n">context</span><span class="p">)</span>
+
+            <span class="c"># go through the fixed params</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_get_paste_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">,</span>
+                                   <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span>
+            
+            <span class="c"># go through the str params</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_get_paste_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">,</span>
+                                   <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span>
+                
+            <span class="k">return</span> <span class="bp">True</span>
+        <span class="k">return</span> <span class="bp">None</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_get_paste_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">param</span><span class="p">,</span> <span class="n">orient_param</span><span class="p">,</span> <span class="n">content</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Helping set values of the params</span>
+<span class="sd">        </span>
+<span class="sd">        : param param:  parameters</span>
+<span class="sd">        : param orient_param: oritational params</span>
+<span class="sd">        : param content: dictionary [ name, value: name1.value1,...]</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># go through the str params</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">param</span><span class="p">:</span>
+            <span class="c"># 2D</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">content</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                    <span class="n">check</span> <span class="o">=</span> <span class="n">content</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
+                    <span class="n">pd</span> <span class="o">=</span> <span class="n">content</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
+                    <span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="nb">float</span><span class="p">(</span><span class="n">pd</span><span class="p">)</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="c">#continue</span>
+                            <span class="k">if</span> <span class="ow">not</span> <span class="n">pd</span> <span class="ow">and</span> <span class="n">pd</span> <span class="o">!=</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                                <span class="k">continue</span>
+                    <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">pd</span><span class="p">))</span>
+                    <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span> <span class="ow">and</span> <span class="n">pd</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                        <span class="c"># Only array func has pd == &#39;&#39; case.</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;ComboBox&quot;</span><span class="p">:</span>
+                        <span class="k">if</span> <span class="n">content</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span><span class="p">:</span>
+                            <span class="n">fun_val</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span><span class="p">[</span><span class="n">content</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">]]</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">fun_val</span><span class="p">)</span>
+                    
+                    <span class="n">value</span> <span class="o">=</span> <span class="n">content</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">:]</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_paste_poly_help</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">check</span> <span class="o">==</span> <span class="s">&#39;True&#39;</span><span class="p">:</span>
+                        <span class="n">is_true</span> <span class="o">=</span> <span class="bp">True</span>
+                    <span class="k">elif</span> <span class="n">check</span> <span class="o">==</span> <span class="s">&#39;False&#39;</span><span class="p">:</span>
+                        <span class="n">is_true</span> <span class="o">=</span> <span class="bp">False</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">is_true</span> <span class="o">=</span> <span class="bp">None</span>
+                    <span class="k">if</span> <span class="n">is_true</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">is_true</span><span class="p">)</span>
+            <span class="c"># 1D</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="c">## for 1D all parameters except orientation</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">in</span> <span class="n">orient_param</span><span class="p">:</span>
+                    <span class="n">name</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                    <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">content</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                        <span class="n">check</span> <span class="o">=</span> <span class="n">content</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
+                        <span class="c"># Avoid changing combox content</span>
+                        <span class="n">value</span> <span class="o">=</span> <span class="n">content</span><span class="p">[</span><span class="n">name</span><span class="p">][</span><span class="mi">1</span><span class="p">:]</span>
+                        <span class="n">pd</span> <span class="o">=</span> <span class="n">value</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                        <span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                            <span class="k">try</span><span class="p">:</span>
+                                <span class="n">pd</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">pd</span><span class="p">)</span>
+                            <span class="k">except</span><span class="p">:</span>
+                                <span class="c">#continue</span>
+                                <span class="k">if</span> <span class="ow">not</span> <span class="n">pd</span> <span class="ow">and</span> <span class="n">pd</span> <span class="o">!=</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                                    <span class="k">continue</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">pd</span><span class="p">))</span>
+                        <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span> <span class="ow">and</span> <span class="n">pd</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                            <span class="c"># Only array func has pd == &#39;&#39; case.</span>
+                            <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                        <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;ComboBox&quot;</span><span class="p">:</span>
+                            <span class="k">if</span> <span class="n">value</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span><span class="p">:</span>
+                                <span class="n">fun_val</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span><span class="p">[</span><span class="n">value</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span>
+                                <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">fun_val</span><span class="p">)</span>
+                                <span class="c"># save state</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">_paste_poly_help</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+                        <span class="k">if</span> <span class="n">check</span> <span class="o">==</span> <span class="s">&#39;True&#39;</span><span class="p">:</span>
+                            <span class="n">is_true</span> <span class="o">=</span> <span class="bp">True</span>
+                        <span class="k">elif</span> <span class="n">check</span> <span class="o">==</span> <span class="s">&#39;False&#39;</span><span class="p">:</span>
+                            <span class="n">is_true</span> <span class="o">=</span> <span class="bp">False</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="n">is_true</span> <span class="o">=</span> <span class="bp">None</span>
+                        <span class="k">if</span> <span class="n">is_true</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                            <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">is_true</span><span class="p">)</span>
+                        
+    <span class="k">def</span> <span class="nf">_paste_poly_help</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Helps get paste for poly function</span>
+<span class="sd">        </span>
+<span class="sd">        :param item: Gui param items</span>
+<span class="sd">        :param value: the values for parameter ctrols</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">is_array</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">value</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="c"># Only for dispersion func.s</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">item</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">value</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                <span class="n">selection</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span><span class="o">.</span><span class="n">Name</span>
+                <span class="n">param_name</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="n">dispersity</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">7</span><span class="p">]</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">selection</span><span class="p">)</span>
+                <span class="n">disp_model</span> <span class="o">=</span> <span class="n">dispersity</span><span class="p">()</span>
+                <span class="c"># Only for array disp</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">pd_vals</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
+                    <span class="n">pd_weights</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">[</span><span class="mi">3</span><span class="p">])</span>
+                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">pd_vals</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">pd_vals</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">pd_vals</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">pd_weights</span><span class="p">):</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">_set_disp_array_cb</span><span class="p">(</span><span class="n">item</span><span class="o">=</span><span class="n">item</span><span class="p">)</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">_set_array_disp_model</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span>
+                                                       <span class="n">disp</span><span class="o">=</span><span class="n">disp_model</span><span class="p">,</span>
+                                                       <span class="n">values</span><span class="o">=</span><span class="n">pd_vals</span><span class="p">,</span>
+                                                       <span class="n">weights</span><span class="o">=</span><span class="n">pd_weights</span><span class="p">)</span>
+                            <span class="n">is_array</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">is_array</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">disp_model</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_dispersion</span><span class="p">(</span><span class="n">name</span><span class="p">,</span>
+                                              <span class="n">disp_model</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> \
+                                              <span class="n">disp_model</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">set_dispersion</span><span class="p">(</span><span class="n">param_name</span><span class="p">,</span> <span class="n">disp_model</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">values</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">values</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">weights</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">weights</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">_persistency_dict</span><span class="p">[</span><span class="n">param_name</span><span class="p">]</span> <span class="o">=</span> \
+                                            <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">values</span><span class="p">,</span>
+                                             <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">weights</span><span class="p">]</span>
+                         
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">print</span> <span class="s">&quot;Error in BasePage._paste_poly_help: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+    
+    <span class="k">def</span> <span class="nf">_set_disp_array_cb</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set cb for array disp</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="BasicPage.update_pinhole_smear"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.update_pinhole_smear">[docs]</a>    <span class="k">def</span> <span class="nf">update_pinhole_smear</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Method to be called by sub-classes</span>
+<span class="sd">            Moveit; This method doesn&#39;t belong here</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">print</span> <span class="s">&quot;BasicPage.update_pinhole_smear was called: skipping&quot;</span>
+        <span class="k">return</span>
+
+
+
+</div>
+    <span class="k">def</span> <span class="nf">_read_category_info</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Reads the categories in from file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+
+        <span class="c"># # ILL mod starts here - July 2012 kieranrcampbell@gmail.com</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">master_category_dict</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">by_model_dict</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_enabled_dict</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">bool</span><span class="p">)</span>
+
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">categorization_file</span> <span class="o">=</span> <span class="n">CategoryInstaller</span><span class="o">.</span><span class="n">get_user_file</span><span class="p">()</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">categorization_file</span><span class="p">):</span>
+                <span class="n">categorization_file</span> <span class="o">=</span> <span class="n">CategoryInstaller</span><span class="o">.</span><span class="n">get_default_file</span><span class="p">()</span>
+            <span class="n">cat_file</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">categorization_file</span><span class="p">,</span> <span class="s">&#39;rb&#39;</span><span class="p">)</span>                           
+            <span class="bp">self</span><span class="o">.</span><span class="n">master_category_dict</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">cat_file</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_regenerate_model_dict</span><span class="p">()</span>
+            <span class="n">cat_file</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+
+        <span class="k">except</span> <span class="ne">IOError</span><span class="p">:</span>
+            <span class="k">raise</span>
+            <span class="k">print</span> <span class="s">&#39;Problem reading in category file.&#39;</span>
+            <span class="k">print</span> <span class="s">&#39;We even looked for it, made sure it was there.&#39;</span>
+            <span class="k">print</span> <span class="s">&#39;An existential crisis if there ever was one.&#39;</span>
+
+    <span class="k">def</span> <span class="nf">_regenerate_model_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        regenerates self.by_model_dict which has each model name as the </span>
+<span class="sd">        key and the list of categories belonging to that model</span>
+<span class="sd">        along with the enabled mapping</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">by_model_dict</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">category</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">master_category_dict</span><span class="p">:</span>
+            <span class="k">for</span> <span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">enabled</span><span class="p">)</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">master_category_dict</span><span class="p">[</span><span class="n">category</span><span class="p">]:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">by_model_dict</span><span class="p">[</span><span class="n">model</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">category</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_enabled_dict</span><span class="p">[</span><span class="n">model</span><span class="p">]</span> <span class="o">=</span> <span class="n">enabled</span>
+    
+    <span class="k">def</span> <span class="nf">_populate_listbox</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fills out the category list box</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">uncat_str</span> <span class="o">=</span> <span class="s">&#39;Customized Models&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_read_category_info</span><span class="p">()</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="n">cat_list</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">master_category_dict</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">uncat_str</span> <span class="ow">in</span> <span class="n">cat_list</span><span class="p">:</span>
+            <span class="n">cat_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">uncat_str</span><span class="p">)</span>
+        
+        <span class="k">for</span> <span class="n">category</span> <span class="ow">in</span> <span class="n">cat_list</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">category</span> <span class="o">!=</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">category</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">NOT_FOUND</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span> \
+                <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">())</span>
+
+        <span class="c">#self._on_change_cat(None)</span>
+
+
+    <span class="k">def</span> <span class="nf">_on_change_cat</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Callback for category change action</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">category</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">GetStringSelection</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">category</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_box</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+
+        <span class="k">if</span> <span class="n">category</span> <span class="o">==</span> <span class="s">&#39;Customized Models&#39;</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">model</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">[</span><span class="n">category</span><span class="p">]:</span>
+                <span class="n">str_m</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="p">)</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;.&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_box</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">str_m</span><span class="p">)</span>
+
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">for</span> <span class="p">(</span><span class="n">model</span><span class="p">,</span><span class="n">enabled</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">sorted</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">master_category_dict</span><span class="p">[</span><span class="n">category</span><span class="p">],</span>
+                                      <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">name</span><span class="p">:</span> <span class="n">name</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span>
+                <span class="k">if</span><span class="p">(</span><span class="n">enabled</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model_box</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">model</span><span class="p">)</span>
+
+
+
+
+    <span class="k">def</span> <span class="nf">_fill_model_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sizer</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill sizer containing model info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">##Add model function Details button in fitpanel.</span>
+        <span class="c">##The following 3 lines are for Mac. Let JHC know before modifying...</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="s">&quot;Model&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mbox_description</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">title</span><span class="p">))</span>
+        <span class="n">boxsizer1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mbox_description</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">sizer_cat</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mbox_description</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">RED</span><span class="p">)</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_help</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&#39;Details&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">80</span><span class="p">,</span> <span class="mi">23</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_help</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_model_help_clicked</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_help</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Model Function Help&quot;</span><span class="p">)</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Show 2D&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">80</span><span class="p">,</span> <span class="mi">23</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_view</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onModel2D</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="n">hint</span> <span class="o">=</span> <span class="s">&quot;toggle view of model from 1D to 2D  or 2D to 1D&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint</span><span class="p">)</span>
+        
+        <span class="n">cat_set_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Category&#39;</span><span class="p">)</span>
+        <span class="n">sizer_cat_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">cat_set_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
+        <span class="n">sizer_cat_box</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="mi">200</span><span class="p">,</span> <span class="mi">50</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">SetToolTip</span><span class="p">(</span> <span class="n">wx</span><span class="o">.</span><span class="n">ToolTip</span><span class="p">(</span><span class="s">&quot;Select a Category/Type&quot;</span><span class="p">)</span> <span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_populate_listbox</span><span class="p">()</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_show_combox</span><span class="p">)</span>
+        <span class="c">#self.shape_rbutton = wx.RadioButton(self, -1, &#39;Shapes&#39;,</span>
+        <span class="c">#                                     style=wx.RB_GROUP)</span>
+        <span class="c">#self.shape_indep_rbutton = wx.RadioButton(self, -1,</span>
+        <span class="c">#                                          &quot;Shape-Independent&quot;)</span>
+        <span class="c">#self.struct_rbutton = wx.RadioButton(self, -1, &quot;Structure Factor &quot;)</span>
+        <span class="c">#self.plugin_rbutton = wx.RadioButton(self, -1, &quot;Uncategorized&quot;)</span>
+                
+        <span class="c">#self.Bind(wx.EVT_RADIOBUTTON, self._show_combox,</span>
+        <span class="c">#                   id=self.shape_rbutton.GetId())</span>
+        <span class="c">#self.Bind(wx.EVT_RADIOBUTTON, self._show_combox,</span>
+        <span class="c">#                    id=self.shape_indep_rbutton.GetId())</span>
+        <span class="c">#self.Bind(wx.EVT_RADIOBUTTON, self._show_combox,</span>
+        <span class="c">#                    id=self.struct_rbutton.GetId())</span>
+        <span class="c">#self.Bind(wx.EVT_RADIOBUTTON, self._show_combox,</span>
+        <span class="c">#                    id=self.plugin_rbutton.GetId())</span>
+        <span class="c">#MAC needs SetValue</span>
+        
+        <span class="n">show_cat_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Modify&quot;</span><span class="p">)</span>
+        <span class="n">cat_tip</span> <span class="o">=</span> <span class="s">&quot;Modify model categories </span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">cat_tip</span> <span class="o">+=</span> <span class="s">&quot;(also accessible from the menu bar).&quot;</span>
+        <span class="n">show_cat_button</span><span class="o">.</span><span class="n">SetToolTip</span><span class="p">(</span> <span class="n">wx</span><span class="o">.</span><span class="n">ToolTip</span><span class="p">(</span><span class="n">cat_tip</span><span class="p">)</span> <span class="p">)</span>
+        <span class="n">show_cat_button</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_modify_cat</span><span class="p">)</span>
+        <span class="n">sizer_cat_box</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
+        <span class="n">sizer_cat_box</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span><span class="mi">10</span><span class="p">))</span>
+        <span class="n">sizer_cat_box</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">show_cat_button</span><span class="p">)</span>
+        <span class="c">#self.shape_rbutton.SetValue(True)</span>
+      
+        <span class="n">sizer_radiobutton</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridSizer</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+
+        <span class="c">#sizer_radiobutton.Add(self.shape_rbutton)</span>
+        <span class="c">#sizer_radiobutton.Add(self.shape_indep_rbutton)</span>
+        <span class="n">sizer_radiobutton</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">5</span><span class="p">))</span>
+        <span class="n">sizer_radiobutton</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="c">#sizer_radiobutton.Add(self.plugin_rbutton)</span>
+        <span class="c">#sizer_radiobutton.Add(self.struct_rbutton)</span>
+        <span class="n">sizer_radiobutton</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">5</span><span class="p">))</span>
+        <span class="n">sizer_radiobutton</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_help</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_cat</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_cat_box</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mf">2.5</span><span class="p">)</span>
+        <span class="n">sizer_cat</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_radiobutton</span><span class="p">)</span>
+        <span class="n">sizer_selection</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>
+        <span class="n">mutifactor_selection</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>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">text1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">text2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;P(Q)*S(Q)&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;No. of Shells: &quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_sld_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Show SLD Profile&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_sld_button</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_show_sld</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">SetToolTip</span><span class="p">(</span> <span class="n">wx</span><span class="o">.</span><span class="n">ToolTip</span><span class="p">(</span><span class="s">&quot;Select a Model&quot;</span><span class="p">)</span> <span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">initialize_combox</span><span class="p">()</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_model</span><span class="p">)</span>
+
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_model</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_model</span><span class="p">)</span>
+        <span class="c">## check model type to show sizer</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">print</span> <span class="s">&quot;_set_model_sizer_selection: disabled.&quot;</span>
+            <span class="c">#self._set_model_sizer_selection(self.model)</span>
+        
+        <span class="n">sizer_selection</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">text1</span><span class="p">)</span>
+        <span class="n">sizer_selection</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="n">sizer_selection</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="p">)</span>
+        <span class="n">sizer_selection</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">5</span><span class="p">))</span>
+        <span class="n">sizer_selection</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">text2</span><span class="p">)</span>
+        <span class="n">sizer_selection</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">5</span><span class="p">))</span>
+        <span class="n">sizer_selection</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="p">)</span>
+       
+        <span class="n">mutifactor_selection</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">13</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="n">mutifactor_selection</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text</span><span class="p">)</span>
+        <span class="n">mutifactor_selection</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="p">)</span>
+        <span class="n">mutifactor_selection</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">5</span><span class="p">))</span>
+        <span class="n">mutifactor_selection</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mutifactor_text1</span><span class="p">)</span>
+        <span class="n">mutifactor_selection</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="n">mutifactor_selection</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">show_sld_button</span><span class="p">)</span>
+
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_cat</span><span class="p">)</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_selection</span><span class="p">)</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">mutifactor_selection</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_multfactor_combobox</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_sld_button</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer1</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+<div class="viewcode-block" id="BasicPage.on_smear_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.on_smear_helper">[docs]</a>    <span class="k">def</span> <span class="nf">on_smear_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Help for onSmear if implemented</span>
+<span class="sd">        </span>
+<span class="sd">        :param update: force or not to update</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="BasicPage.reset_page"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.reset_page">[docs]</a>    <span class="k">def</span> <span class="nf">reset_page</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="p">,</span> <span class="n">first</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        reset the state  if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="BasicPage.onSmear"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.onSmear">[docs]</a>    <span class="k">def</span> <span class="nf">onSmear</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create a smear object if implemented </span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="BasicPage.onPinholeSmear"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.onPinholeSmear">[docs]</a>    <span class="k">def</span> <span class="nf">onPinholeSmear</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create a custom pinhole smear object if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="BasicPage.onSlitSmear"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.onSlitSmear">[docs]</a>    <span class="k">def</span> <span class="nf">onSlitSmear</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create a custom slit smear object if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="BasicPage.update_slit_smear"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.update_slit_smear">[docs]</a>    <span class="k">def</span> <span class="nf">update_slit_smear</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        called by kill_focus on pinhole TextCntrl</span>
+<span class="sd">        to update the changes if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="BasicPage.select_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.select_param">[docs]</a>    <span class="k">def</span> <span class="nf">select_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Select TextCtrl  checked if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="BasicPage.set_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.set_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Sets data if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+    <span class="k">def</span> <span class="nf">_is_2D</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check if data_name is Data2D if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">_on_select_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        call back for model selection if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+<div class="viewcode-block" id="BasicPage.select_all_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.select_all_param">[docs]</a>    <span class="k">def</span> <span class="nf">select_all_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set to true or false all checkBox if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="BasicPage.get_weight_flag"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_weight_flag">[docs]</a>    <span class="k">def</span> <span class="nf">get_weight_flag</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get flag corresponding to a given weighting dI data if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+    <span class="k">def</span> <span class="nf">_set_sizer_dispersion</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        draw sizer for dispersity if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+<div class="viewcode-block" id="BasicPage.get_all_checked_params"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.get_all_checked_params">[docs]</a>    <span class="k">def</span> <span class="nf">get_all_checked_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Found all parameters current check and add them to list of parameters</span>
+<span class="sd">        to fit if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="BasicPage.show_npts2fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.basepage.BasicPage.show_npts2fit">[docs]</a>    <span class="k">def</span> <span class="nf">show_npts2fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        setValue Npts for fitting if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+    <span class="k">def</span> <span class="nf">_onModel2D</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        toggle view of model from 1D to 2D  or 2D from 1D if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/batchfitpage.html
===================================================================
--- _modules/sas/perspectives/fitting/batchfitpage.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/batchfitpage.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,485 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.batchfitpage &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.batchfitpage</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">Batch panel</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">wx.lib.newevent</span>
+<span class="kn">import</span> <span class="nn">math</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>    
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">NewPlotEvent</span>  
+
+<span class="p">(</span><span class="n">Chi2UpdateEvent</span><span class="p">,</span> <span class="n">EVT_CHI2_UPDATE</span><span class="p">)</span>   <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">newevent</span><span class="o">.</span><span class="n">NewEvent</span><span class="p">()</span>
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">76</span>
+<span class="n">_DATA_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">300</span>
+<span class="n">SMEAR_SIZE_L</span> <span class="o">=</span> <span class="mf">0.00</span>
+<span class="n">SMEAR_SIZE_H</span> <span class="o">=</span> <span class="mf">0.00</span>
+
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.basepage</span> <span class="kn">import</span> <span class="n">PageInfoEvent</span>
+<span class="kn">from</span> <span class="nn">sas.models.qsmearing</span> <span class="kn">import</span> <span class="n">smear_selection</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.fitpage</span> <span class="kn">import</span> <span class="n">FitPage</span>
+
+<div class="viewcode-block" id="BatchFitPage"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.batchfitpage.BatchFitPage">[docs]</a><span class="k">class</span> <span class="nc">BatchFitPage</span><span class="p">(</span><span class="n">FitPage</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Batch Page</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;BatchFit&quot;</span>
+    <span class="n">window_caption</span>  <span class="o">=</span> <span class="s">&quot;BatchFit&quot;</span>
+
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Initialization of the Panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">FitPage</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;BatchFit&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">window_caption</span>  <span class="o">=</span> <span class="s">&quot;BatchFit&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_fill_range_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing the plotting range</span>
+<span class="sd">        add  access to npts</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">is_2Ddata</span> <span class="o">=</span> <span class="bp">False</span>
+        
+        <span class="c"># Check if data is 2D</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span>  <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                        <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+            <span class="n">is_2Ddata</span> <span class="o">=</span> <span class="bp">True</span>
+            
+        <span class="n">title</span> <span class="o">=</span> <span class="s">&quot;Fitting&quot;</span>     
+        <span class="bp">self</span><span class="o">.</span><span class="n">_get_smear_info</span><span class="p">()</span>
+        
+        <span class="c">#Sizers</span>
+        <span class="n">box_description_range</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">title</span><span class="p">))</span>
+        <span class="n">boxsizer_range</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">box_description_range</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>      
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</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>
+        <span class="c">#sizer_smearer = wx.BoxSizer(wx.HORIZONTAL)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_masking</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>
+        <span class="n">sizer_chi2</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>
+
+        <span class="n">sizer_fit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridSizer</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
+        <span class="c">#Fit button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span> <span class="s">&#39;Fit&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">88</span><span class="p">,</span> <span class="mi">25</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">default_bt_colour</span> <span class="o">=</span>  <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">GetDefaultAttributes</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onFit</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Start fitting.&quot;</span><span class="p">)</span>
+
+        <span class="c"># Update and Draw button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span> <span class="s">&#39;Compute&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">88</span><span class="p">,</span> <span class="mi">24</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_button</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_BUTTON</span><span class="p">,</span> \
+                              <span class="bp">self</span><span class="o">.</span><span class="n">_onDraw</span><span class="p">,</span><span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Compute and Draw.&quot;</span><span class="p">)</span>  
+        <span class="n">sizer_fit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_fit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">sizer_chi2</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="c"># get smear_selection</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">=</span> <span class="n">smear_selection</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="p">)</span>
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_masking</span><span class="p">)</span>
+         <span class="c">#2D data? default</span>
+        <span class="n">is_2Ddata</span> <span class="o">=</span> <span class="bp">False</span>
+        
+        <span class="c">#check if it is 2D data</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span>  <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                        <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+            <span class="n">is_2Ddata</span> <span class="o">=</span> <span class="bp">True</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer5</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+     
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span>  <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> 
+                                          <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span> 
+                                    <span class="n">text_enter_callback</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onQrangeEnter</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Minimun value of Q in linear scale.&quot;</span><span class="p">)</span>
+     
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span>  <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> 
+                                          <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span> 
+                                        <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onQrangeEnter</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Maximum value of Q in linear scale.&quot;</span><span class="p">)</span>
+        
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_qrange</span> <span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&#39;Reset&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">77</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+      
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_qrange</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_reset_clicked</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_qrange</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+                                    <span class="s">&quot;Reset Q range to the default values&quot;</span><span class="p">)</span>
+     
+        <span class="n">sizer_horizontal</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>
+        <span class="n">sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridSizer</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span><span class="s">&#39;Editor&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">88</span><span class="p">,</span> <span class="mi">23</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</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_BUTTON</span><span class="p">,</span> 
+                             <span class="bp">self</span><span class="o">.</span><span class="n">_onMask</span><span class="p">,</span><span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Edit Mask.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39; Masking(2D)&#39;</span><span class="p">)</span>
+
+        <span class="n">sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Q range&#39;</span><span class="p">))</span>     
+        <span class="n">sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39; Min[1/A]&#39;</span><span class="p">))</span>
+        <span class="n">sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39; Max[1/A]&#39;</span><span class="p">))</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="p">)</span>
+ 
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">reset_qrange</span><span class="p">)</span>   
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="p">)</span>
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_chi2</span><span class="p">)</span> 
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer</span><span class="p">)</span>
+        
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">15</span><span class="p">))</span>
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_fit</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">is_2Ddata</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>  
+            <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span> 
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>  
+            <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+
+        <span class="c">## save state</span>
+        <span class="c">#self.save_current_state()</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer5</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer_range</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer5</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+       
+    <span class="k">def</span> <span class="nf">_on_select_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span> 
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        call back for model selection</span>
+<span class="sd">        &quot;&quot;&quot;</span>  
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>    
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_model_helper</span><span class="p">()</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_model_param_sizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>                   
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_keep</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_dispers_sizer</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">structurecombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">formfactorcombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+      
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_copy_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_paste_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_keep</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                
+            <span class="n">temp_smear</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="c">## event to post model to fit to fitting plugins</span>
+            <span class="p">(</span><span class="n">ModelEventbox</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">newevent</span><span class="o">.</span><span class="n">NewEvent</span><span class="p">()</span>
+         
+            <span class="c">## set smearing value whether or not </span>
+            <span class="c">#    the data contain the smearing info</span>
+            <span class="n">evt</span> <span class="o">=</span> <span class="n">ModelEventbox</span><span class="p">(</span><span class="n">model</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">,</span> 
+                                        <span class="n">smearer</span><span class="o">=</span><span class="n">temp_smear</span><span class="p">,</span> 
+                                        <span class="n">qmin</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">),</span>
+                                        <span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span>
+                                     <span class="n">qmax</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">))</span> 
+   
+            <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">_on_model_panel</span><span class="p">(</span><span class="n">evt</span><span class="o">=</span><span class="n">evt</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">mbox_description</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;Model [</span><span class="si">%s</span><span class="s">]&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span>
+
+            
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c">## post state to fit panel</span>
+            <span class="n">new_event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">new_event</span><span class="p">)</span> 
+            <span class="c">#update list of plugins if new plugin is available</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">plugin_rbutton</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="n">temp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_model_list</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">temp</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="n">temp</span>
+                    <span class="n">current_val</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+                    <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_show_combox_helper</span><span class="p">()</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">current_val</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_onDraw</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>   
+        
+    <span class="k">def</span> <span class="nf">_update_paramv_on_fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        make sure that update param values just before the fitting</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#flag for qmin qmax check values</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">False</span>
+
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>           
+            <span class="c">##Check the values</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_check_value_enter</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">,</span> <span class="n">is_modified</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_check_value_enter</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">,</span> <span class="n">is_modified</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_check_value_enter</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">,</span> <span class="n">is_modified</span><span class="p">)</span>
+
+            <span class="c"># If qmin and qmax have been modified, update qmin and qmax and </span>
+             <span class="c"># Here we should check whether the boundaries have been modified.</span>
+            <span class="c"># If qmin and qmax have been modified, update qmin and qmax and </span>
+            <span class="c"># set the is_modified flag to True</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span><span class="p">:</span>
+                <span class="n">tempmin</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                <span class="k">if</span> <span class="n">tempmin</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="n">tempmin</span>
+                <span class="n">tempmax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                <span class="k">if</span> <span class="n">tempmax</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="n">tempmax</span>
+                <span class="k">if</span> <span class="n">tempmax</span> <span class="o">==</span> <span class="n">tempmin</span><span class="p">:</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>    
+                <span class="c">#temp_smearer = None</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+                    <span class="c"># only 2D case set mask  </span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_Npts</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+                        <span class="k">return</span> <span class="n">flag</span>
+            <span class="k">else</span><span class="p">:</span> <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">else</span><span class="p">:</span> 
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+
+        <span class="c">#For invalid q range, disable the mask editor and fit button, vs.    </span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span><span class="p">:</span>
+            <span class="c">#self.btFit.Disable()</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c">#self.btFit.Enable(True)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">()</span> <span class="ow">and</span>  <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Cannot Plot or Fit :Must select a &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; model or Fitting range is not valid!!!  &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+   
+        <span class="k">return</span> <span class="n">flag</span>  
+<div class="viewcode-block" id="BatchFitPage.save_current_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.batchfitpage.BatchFitPage.save_current_state">[docs]</a>    <span class="k">def</span> <span class="nf">save_current_state</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Currently no save option implemented for batch page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">pass</span> </div>
+<div class="viewcode-block" id="BatchFitPage.save_current_state_fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.batchfitpage.BatchFitPage.save_current_state_fit">[docs]</a>    <span class="k">def</span> <span class="nf">save_current_state_fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Currently no save option implemented for batch page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">pass</span></div>
+<div class="viewcode-block" id="BatchFitPage.set_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.batchfitpage.BatchFitPage.set_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        reset the current data </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#id = None</span>
+        <span class="n">group_id</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c">#id = data.id</span>
+            <span class="n">group_id</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data_min</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+            <span class="n">data_max</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+            <span class="n">data_name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_keep</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_keep</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+  
+            <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="n">data_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span>
+            <span class="c">#set maximum range for x in linear scale</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span><span class="s">&quot;data&quot;</span><span class="p">):</span> <span class="c">#Display only for 1D data fit</span>
+                <span class="c"># Minimum value of data   </span>
+                <span class="n">data_min</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+                <span class="c"># Maximum value of data  </span>
+                <span class="n">data_max</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>  
+                <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                
+                <span class="c">## Minimum value of data </span>
+                <span class="n">data_min</span> <span class="o">=</span> <span class="mi">0</span>
+                <span class="n">x</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xmin</span><span class="p">),</span> <span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xmax</span><span class="p">))</span> 
+                <span class="n">y</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">ymin</span><span class="p">),</span> <span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">ymax</span><span class="p">))</span>
+                <span class="c">## Maximum value of data  </span>
+                <span class="n">data_max</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">x</span><span class="o">*</span><span class="n">x</span> <span class="o">+</span> <span class="n">y</span><span class="o">*</span><span class="n">y</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>  
+                <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span> 
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">data_name</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="n">data_min</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="n">data_max</span>
+        <span class="c">#self.minimum_q.SetValue(str(data_min))</span>
+        <span class="c">#self.maximum_q.SetValue(str(data_max))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data_min</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data_max</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span>
+        
+        <span class="c">#update model plot with new data information</span>
+        <span class="k">if</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="c">#set model view button</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;2D Mode&quot;</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;1D Mode&quot;</span><span class="p">)</span>
+                
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                             <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">group_id</span><span class="o">=</span><span class="n">group_id</span><span class="p">,</span>
+                                               <span class="n">action</span><span class="o">=</span><span class="s">&quot;delete&quot;</span><span class="p">))</span>
+            <span class="c">#plot the current selected data</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> 
+                                                    <span class="n">title</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">title</span><span class="p">)))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">store_data</span><span class="p">(</span><span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                                     <span class="n">data_list</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data_list</span><span class="p">,</span>
+                                      <span class="n">caption</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">window_name</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+    
+
+        </div></div>
+<div class="viewcode-block" id="BGTextCtrl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.batchfitpage.BGTextCtrl">[docs]</a><span class="k">class</span> <span class="nc">BGTextCtrl</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Text control used to display outputs.</span>
+<span class="sd">    No editing allowed. The background is </span>
+<span class="sd">    grayed out. User can&#39;t select text.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetParent</span><span class="p">()</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">GetBackgroundColour</span><span class="p">())</span>
+        
+        <span class="c"># Bind to mouse event to avoid text highlighting</span>
+        <span class="c"># The event will be skipped once the call-back</span>
+        <span class="c"># is called.</span>
+        <span class="bp">self</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_MOUSE_EVENTS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_click</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_click</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Prevent further handling of the mouse event</span>
+<span class="sd">        by not calling Skip().</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="k">pass</span>
+ </div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/console.html
===================================================================
--- _modules/sas/perspectives/fitting/console.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/console.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,275 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.console &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.console</h1><div class="highlight"><pre>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span> 
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">from</span> <span class="nn">sas.fit</span> <span class="kn">import</span> <span class="n">FitHandler</span>
+
+<span class="k">class</span> <span class="nc">ConsoleUpdate</span><span class="p">(</span><span class="n">FitHandler</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Print progress to the console.</span>
+<div class="viewcode-block" id="ConsoleUpdate"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate">[docs]</a><span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">isbetter</span> <span class="o">=</span> <span class="bp">False</span>
+    <span class="sd">&quot;&quot;&quot;Record whether results improved since last update&quot;&quot;&quot;</span>
+    <span class="n">progress_delta</span> <span class="o">=</span>  <span class="mi">60</span>
+    <span class="sd">&quot;&quot;&quot;Number of seconds between progress updates&quot;&quot;&quot;</span>
+    <span class="n">improvement_delta</span> <span class="o">=</span> <span class="mi">5</span>
+    <span class="sd">&quot;&quot;&quot;Number of seconds between improvement updates&quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">quiet</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span><span class="n">progress_delta</span><span class="o">=</span><span class="mi">60</span><span class="p">,</span><span class="n">improvement_delta</span><span class="o">=</span><span class="mi">5</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        If quiet is true, only print out final summary, not progress and</span>
+<span class="sd">        improvements.</span>
+<span class="sd">        </span>
+<span class="sd">        :attr parent: the object that handle the messages</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">progress_time</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">progress_percent</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">improvement_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">progress_time</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">isbetter</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">quiet</span> <span class="o">=</span> <span class="n">quiet</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">progress_delta</span> <span class="o">=</span> <span class="n">progress_delta</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">improvement_delta</span> <span class="o">=</span> <span class="n">improvement_delta</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">elapsed_time</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">update_duration</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_duration</span> <span class="o">=</span> <span class="mi">0</span>
+        
+        
+    <span class="k">def</span> <span class="nf">progress</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">n</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Report on progress.</span>
+<div class="viewcode-block" id="ConsoleUpdate.progress"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate.progress">[docs]</a><span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">quiet</span><span class="p">:</span> <span class="k">return</span>
+
+        <span class="n">t</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="n">p</span> <span class="o">=</span> <span class="nb">int</span><span class="p">((</span><span class="mi">100</span><span class="o">*</span><span class="n">k</span><span class="p">)</span><span class="o">//</span><span class="n">n</span><span class="p">)</span>
+        
+        <span class="c"># Show improvements if there are any</span>
+        <span class="n">dt</span> <span class="o">=</span> <span class="n">t</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">improvement_time</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isbetter</span> <span class="ow">and</span> <span class="n">dt</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">improvement_delta</span><span class="p">:</span>
+            <span class="c">#self.result.print_summary()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">update_fit</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">isbetter</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">improvement_time</span> <span class="o">=</span> <span class="n">t</span>
+       
+        <span class="c"># Update percent complete</span>
+        <span class="n">dp</span> <span class="o">=</span> <span class="n">p</span><span class="o">-</span><span class="bp">self</span><span class="o">.</span><span class="n">progress_percent</span>
+        <span class="k">if</span> <span class="n">dp</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span> <span class="k">return</span>
+        <span class="n">dt</span> <span class="o">=</span> <span class="n">t</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">progress_time</span>
+        <span class="k">if</span> <span class="n">dt</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">progress_delta</span><span class="p">:</span>
+            <span class="k">if</span> <span class="mi">1</span> <span class="o">&lt;=</span> <span class="n">dp</span> <span class="o">&lt;=</span> <span class="mi">2</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">progress_percent</span> <span class="o">=</span> <span class="n">p</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">progress_time</span> <span class="o">=</span> <span class="n">t</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">update_fit</span><span class="p">()</span>
+            <span class="k">elif</span> <span class="mi">2</span> <span class="o">&lt;</span> <span class="n">dp</span> <span class="o">&lt;=</span> <span class="mi">5</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">p</span><span class="o">//</span><span class="mi">5</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">progress_percent</span><span class="o">//</span><span class="mi">5</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">progress_percent</span> <span class="o">=</span> <span class="n">p</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">progress_time</span> <span class="o">=</span> <span class="n">t</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">p</span><span class="o">//</span><span class="mi">10</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">progress_percent</span><span class="o">//</span><span class="mi">10</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">progress_percent</span> <span class="o">=</span> <span class="n">p</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">progress_time</span> <span class="o">=</span> <span class="n">t</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">update_fit</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">improvement</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Called when a result is observed which is better than previous</span></div>
+<div class="viewcode-block" id="ConsoleUpdate.improvement"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate.improvement">[docs]</a><span class="sd">        results from the fit.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">isbetter</span> <span class="o">=</span> <span class="bp">True</span>
+    
+    <span class="k">def</span> <span class="nf">print_result</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Print result object</span></div>
+<div class="viewcode-block" id="ConsoleUpdate.print_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate.print_result">[docs]</a><span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; </span><span class="se">\n</span><span class="s"> </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                     
+    <span class="k">def</span> <span class="nf">error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Model had an error; print traceback</span></div>
+<div class="viewcode-block" id="ConsoleUpdate.error"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate.error">[docs]</a><span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isbetter</span><span class="p">:</span>
+            <span class="c">#self.result.print_summary()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">update_fit</span><span class="p">()</span>
+
+        <span class="n">message</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; </span><span class="se">\n</span><span class="s"> </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="o">.</span><span class="n">__str__</span><span class="p">()</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="p">,</span>
+                                   <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+    <span class="k">def</span> <span class="nf">stop</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Post event msg and stop</span></div>
+<div class="viewcode-block" id="ConsoleUpdate.stop"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate.stop">[docs]</a><span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isbetter</span><span class="p">:</span>
+            <span class="c">#self.result.print_summary()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">update_fit</span><span class="p">()</span>
+
+        <span class="n">message</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; </span><span class="se">\n</span><span class="s"> </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="o">.</span><span class="n">__str__</span><span class="p">()</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="p">,</span>
+                                   <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">finalize</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="ConsoleUpdate.finalize"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate.finalize">[docs]</a>        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isbetter</span><span class="p">:</span>
+            <span class="c">#self.result.print_summary()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">update_fit</span><span class="p">()</span>
+
+    <span class="k">def</span> <span class="nf">abort</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="ConsoleUpdate.abort"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate.abort">[docs]</a>        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">isbetter</span><span class="p">:</span>
+            <span class="c">#self.result.print_summary()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">update_fit</span><span class="p">()</span>
+            
+        
+    <span class="k">def</span> <span class="nf">update_fit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">last</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="ConsoleUpdate.update_fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate.update_fit">[docs]</a>        <span class="n">t1</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">elapsed_time</span> <span class="o">=</span>  <span class="n">t1</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">update_duration</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">update_duration</span> <span class="o">=</span> <span class="n">t1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_duration</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">elapsed_time</span>
+        <span class="n">str_time</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&quot;%Y-%m-</span><span class="si">%d</span><span class="s"> %H:%M:%S &quot;</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">(</span><span class="n">t1</span><span class="p">))</span>
+        <span class="n">UPDATE_INTERVAL</span> <span class="o">=</span> <span class="mf">5.0</span>
+        <span class="n">u_flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_duration</span> <span class="o">&gt;=</span> <span class="n">UPDATE_INTERVAL</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_duration</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="n">u_flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="n">str_time</span>
+        <span class="k">if</span> <span class="n">u_flag</span> <span class="ow">or</span> <span class="n">last</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">result</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">data_name</span><span class="p">,</span> <span class="n">model_name</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span>
+                <span class="n">d_flag</span> <span class="o">=</span> <span class="p">(</span><span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="p">,</span> <span class="s">&quot;data&quot;</span><span class="p">)</span> <span class="ow">and</span> \
+                    <span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> \
+                    <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="s">&quot;sas_data&quot;</span><span class="p">)</span> <span class="ow">and</span> 
+                    <span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">sas_data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">)</span>
+                <span class="n">m_flag</span> <span class="o">=</span> <span class="p">(</span><span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="p">,</span> <span class="s">&quot;model&quot;</span><span class="p">)</span> <span class="ow">and</span> \
+                          <span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="o">.</span><span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">d_flag</span><span class="p">:</span>
+                    <span class="n">data_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">sas_data</span><span class="o">.</span><span class="n">name</span>
+                <span class="k">if</span> <span class="n">m_flag</span><span class="p">:</span>
+                    <span class="n">model_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">m_flag</span> <span class="ow">and</span> <span class="n">d_flag</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Data : </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span>  <span class="o">%</span> <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data_name</span><span class="p">))</span><span class="c">#,</span>
+                                                     <span class="c">#str(model_name))</span>
+                <span class="n">msg</span> <span class="o">+=</span>  <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">result</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;No result available</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span>
+                                              <span class="nb">type</span><span class="o">=</span><span class="s">&quot;progress&quot;</span><span class="p">))</span>
+     
+    <span class="k">def</span> <span class="nf">starting_fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="ConsoleUpdate.starting_fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate.starting_fit">[docs]</a>        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Starting the Fit...&quot;</span><span class="p">,</span>
+                                        <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span><span class="nb">type</span><span class="o">=</span><span class="s">&quot;progress&quot;</span><span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">set_result</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="ConsoleUpdate.set_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate.set_result">[docs]</a>        <span class="bp">self</span><span class="o">.</span><span class="n">result</span> <span class="o">=</span> <span class="n">result</span>
+    
+    <span class="k">def</span> <span class="nf">get_result</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="ConsoleUpdate.get_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.console.ConsoleUpdate.get_result">[docs]</a>        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">result</span>
+        
+    
+</pre></div></div></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/fit_thread.html
===================================================================
--- _modules/sas/perspectives/fitting/fit_thread.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/fit_thread.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,204 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.fit_thread &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.fit_thread</h1><div class="highlight"><pre>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">from</span> <span class="nn">sas.data_util.calcthread</span> <span class="kn">import</span> <span class="n">CalcThread</span>
+
+<span class="k">def</span> <span class="nf">map_getattr</span><span class="p">(</span><span class="n">classInstance</span><span class="p">,</span> <span class="n">classFunc</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
+<div class="viewcode-block" id="map_getattr"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fit_thread.map_getattr">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Take an instance of a class and a function name as a string.</span>
+<span class="sd">    Execute class.function and return result</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">return</span>  <span class="nb">getattr</span><span class="p">(</span><span class="n">classInstance</span><span class="p">,</span><span class="n">classFunc</span><span class="p">)(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
+
+<span class="k">def</span> <span class="nf">map_apply</span><span class="p">(</span><span class="n">arguments</span><span class="p">):</span></div>
+<div class="viewcode-block" id="map_apply"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fit_thread.map_apply">[docs]</a>    <span class="k">return</span> <span class="nb">apply</span><span class="p">(</span><span class="n">arguments</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">arguments</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span>
+
+<span class="k">class</span> <span class="nc">FitThread</span><span class="p">(</span><span class="n">CalcThread</span><span class="p">):</span></div>
+<div class="viewcode-block" id="FitThread"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fit_thread.FitThread">[docs]</a>    <span class="sd">&quot;&quot;&quot;Thread performing the fit &quot;&quot;&quot;</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> 
+                 <span class="n">fn</span><span class="p">,</span>
+                 <span class="n">page_id</span><span class="p">,</span>
+                 <span class="n">handler</span><span class="p">,</span>
+                 <span class="n">batch_outputs</span><span class="p">,</span>
+                 <span class="n">batch_inputs</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">pars</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">completefn</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">updatefn</span>   <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">yieldtime</span>  <span class="o">=</span> <span class="mf">0.03</span><span class="p">,</span>
+                 <span class="n">worktime</span>   <span class="o">=</span> <span class="mf">0.03</span><span class="p">,</span>
+                 <span class="n">ftol</span>       <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">reset_flag</span> <span class="o">=</span> <span class="bp">False</span><span class="p">):</span>
+        <span class="n">CalcThread</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
+                 <span class="n">completefn</span><span class="p">,</span>
+                 <span class="n">updatefn</span><span class="p">,</span>
+                 <span class="n">yieldtime</span><span class="p">,</span>
+                 <span class="n">worktime</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">handler</span> <span class="o">=</span> <span class="n">handler</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fitter</span> <span class="o">=</span> <span class="n">fn</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pars</span> <span class="o">=</span> <span class="n">pars</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_inputs</span> <span class="o">=</span> <span class="n">batch_inputs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_outputs</span> <span class="o">=</span> <span class="n">batch_outputs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_id</span> <span class="o">=</span> <span class="n">page_id</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">updatefn</span> <span class="o">=</span> <span class="n">updatefn</span>
+        <span class="c">#Relative error desired in the sum of squares.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">ftol</span> <span class="o">=</span> <span class="n">ftol</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_flag</span> <span class="o">=</span> <span class="n">reset_flag</span>
+   
+    <span class="k">def</span> <span class="nf">isquit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="FitThread.isquit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fit_thread.FitThread.isquit">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :raise KeyboardInterrupt: when the thread is interrupted</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">CalcThread</span><span class="o">.</span><span class="n">isquit</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="k">except</span> <span class="ne">KeyboardInterrupt</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fitting: terminated by the user.&quot;</span>
+            <span class="k">raise</span> <span class="ne">KeyboardInterrupt</span><span class="p">,</span> <span class="n">msg</span>
+       
+    <span class="k">def</span> <span class="nf">compute</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="FitThread.compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fit_thread.FitThread.compute">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Perform a fit </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="kn">import</span> <span class="nn">copy</span>
+            <span class="n">list_handler</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="n">list_curr_thread</span> <span class="o">=</span> <span class="p">[]</span> 
+            <span class="n">list_ftol</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="n">list_reset_flag</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="n">list_map_get_attr</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="n">list_fit_function</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="n">list_q</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fitter</span><span class="p">)):</span>
+                <span class="n">list_handler</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">handler</span><span class="p">)</span>
+                <span class="n">list_q</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+                <span class="n">list_curr_thread</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+                <span class="n">list_ftol</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ftol</span><span class="p">)</span>
+                <span class="n">list_reset_flag</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">reset_flag</span><span class="p">)</span>
+                <span class="n">list_fit_function</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&#39;fit&#39;</span><span class="p">)</span>
+                <span class="n">list_map_get_attr</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">map_getattr</span><span class="p">)</span>
+            <span class="c">#from multiprocessing import Pool</span>
+            <span class="n">inputs</span> <span class="o">=</span> <span class="nb">zip</span><span class="p">(</span><span class="n">list_map_get_attr</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">fitter</span><span class="p">,</span> <span class="n">list_fit_function</span><span class="p">,</span>
+                         <span class="n">list_q</span><span class="p">,</span> <span class="n">list_q</span><span class="p">,</span> <span class="n">list_handler</span><span class="p">,</span><span class="n">list_curr_thread</span><span class="p">,</span><span class="n">list_ftol</span><span class="p">,</span>
+                         <span class="n">list_reset_flag</span><span class="p">)</span>
+            <span class="n">result</span> <span class="o">=</span>  <span class="nb">map</span><span class="p">(</span><span class="n">map_apply</span><span class="p">,</span> <span class="n">inputs</span><span class="p">)</span>
+    
+            <span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">(</span><span class="n">result</span><span class="o">=</span><span class="n">result</span><span class="p">,</span>
+                          <span class="n">batch_inputs</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">batch_inputs</span><span class="p">,</span>
+                          <span class="n">batch_outputs</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">batch_outputs</span><span class="p">,</span>
+                          <span class="n">page_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">page_id</span><span class="p">,</span>
+                          <span class="n">pars</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pars</span><span class="p">,</span>
+                          <span class="n">elapsed</span><span class="o">=</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span><span class="o">-</span><span class="bp">self</span><span class="o">.</span><span class="n">starttime</span><span class="p">)</span>
+           
+        <span class="k">except</span> <span class="ne">KeyboardInterrupt</span><span class="p">,</span> <span class="n">msg</span><span class="p">:</span>
+            <span class="c"># Thread was interrupted, just proceed and re-raise.</span>
+            <span class="c"># Real code should not print, but this is an example...</span>
+            <span class="c">#print &quot;keyboard exception&quot;</span>
+            <span class="c">#Stop on exception during fitting. Todo: need to put </span>
+            <span class="c">#some mssg and reset progress bar.</span>
+            
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">handler</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">stop</span><span class="p">(</span><span class="n">msg</span><span class="o">=</span><span class="n">msg</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="kn">import</span> <span class="nn">traceback</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">handler</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">msg</span><span class="o">=</span><span class="n">traceback</span><span class="o">.</span><span class="n">format_exc</span><span class="p">())</span>
+           
+        
+    
+</pre></div></div></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/fitpage.html
===================================================================
--- _modules/sas/perspectives/fitting/fitpage.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/fitpage.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,3384 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.fitpage &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.fitpage</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    FitPanel class contains fields allowing to display results when</span>
+<span class="sd">    fitting  a model and one data</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">wx.lib.newevent</span>
+<span class="kn">import</span> <span class="nn">numpy</span>
+<span class="kn">import</span> <span class="nn">copy</span>
+<span class="kn">import</span> <span class="nn">math</span>
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">NewPlotEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">PlotQrangeEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">check_data_validity</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">format_number</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">check_float</span>
+
+<span class="p">(</span><span class="n">Chi2UpdateEvent</span><span class="p">,</span> <span class="n">EVT_CHI2_UPDATE</span><span class="p">)</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">newevent</span><span class="o">.</span><span class="n">NewEvent</span><span class="p">()</span>
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">76</span>
+<span class="n">_DATA_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">300</span>
+<span class="n">SMEAR_SIZE_L</span> <span class="o">=</span> <span class="mf">0.00</span>
+<span class="n">SMEAR_SIZE_H</span> <span class="o">=</span> <span class="mf">0.00</span>
+
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.basepage</span> <span class="kn">import</span> <span class="n">BasicPage</span> <span class="k">as</span> <span class="n">BasicPage</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.basepage</span> <span class="kn">import</span> <span class="n">PageInfoEvent</span> <span class="k">as</span> <span class="n">PageInfoEvent</span>
+<span class="kn">from</span> <span class="nn">sas.models.qsmearing</span> <span class="kn">import</span> <span class="n">smear_selection</span>
+
+
+<div class="viewcode-block" id="FitPage"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage">[docs]</a><span class="k">class</span> <span class="nc">FitPage</span><span class="p">(</span><span class="n">BasicPage</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    FitPanel class contains fields allowing to display results when</span>
+<span class="sd">    fitting  a model and one data</span>
+<span class="sd">    </span>
+<span class="sd">    :note: For Fit to be performed the user should check at least one parameter</span>
+<span class="sd">        on fit Panel window.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialization of the Panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">BasicPage</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">color</span><span class="p">)</span>
+        
+        <span class="c">## draw sizer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_fill_data_sizer</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_2D</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_started</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weightbt_string</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">m_name</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># get smear info from data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_get_smear_info</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_fill_model_sizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_get_defult_custom_smear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_fill_range_sizer</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_smear</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">EVT_CHI2_UPDATE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_complete_chisqr</span><span class="p">)</span>
+        <span class="c"># bind key event</span>
+        <span class="bp">self</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_RIGHT_DOWN</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_right_down</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_copy_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_paste_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_fit_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_data_combobox</span><span class="p">(</span><span class="n">data_list</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data_list</span><span class="p">)</span>
+        <span class="c">#create a default data for an empty panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">create_default_data</span><span class="p">()</span>
+        <span class="c">#self._manager.frame.Bind(wx.EVT_SET_FOCUS, self.on_set_focus)</span>
+    
+<div class="viewcode-block" id="FitPage.enable_fit_button"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.enable_fit_button">[docs]</a>    <span class="k">def</span> <span class="nf">enable_fit_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Enable fit button if data is valid and model is valid</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="n">check_data_validity</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="n">flag</span><span class="p">)</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_fill_data_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill sizer 0 with data info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_box_description</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;I(q) Data Source&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">check_data_validity</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">):</span>
+            <span class="n">dname_color</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BLUE</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">dname_color</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RED</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_box_description</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">dname_color</span><span class="p">)</span>
+        <span class="n">boxsizer1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_box_description</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="c">#----------------------------------------------------------</span>
+        <span class="n">sizer_data</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_select_data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_DATA_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">sizer_data</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Name : &#39;</span><span class="p">))</span>
+        <span class="n">sizer_data</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="p">)</span>
+        <span class="n">sizer_data</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_data</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer0</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer1</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer0</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+<div class="viewcode-block" id="FitPage.enable_datasource"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.enable_datasource">[docs]</a>    <span class="k">def</span> <span class="nf">enable_datasource</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Enable or disable data source control depending on existing data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_list</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            </div>
+<div class="viewcode-block" id="FitPage.fill_data_combobox"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.fill_data_combobox">[docs]</a>    <span class="k">def</span> <span class="nf">fill_data_combobox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get a list of data and fill the corresponding combobox</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_list</span> <span class="o">=</span> <span class="n">data_list</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_datasource</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="c">#find the maximum range covering all data</span>
+            <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="p">,</span> <span class="n">npts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">compute_data_set_range</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin_data_set</span> <span class="o">=</span> <span class="n">qmin</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax_data_set</span> <span class="o">=</span> <span class="n">qmax</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_data_set</span> <span class="o">=</span> <span class="n">npts</span>
+
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_data_set</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_data_set</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_data_set</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_data_set</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span>
+        <span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">for</span> <span class="n">data</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_list</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> <span class="n">clientData</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">is_data</span><span class="p">:</span>
+                    <span class="n">is_data</span> <span class="o">=</span> <span class="n">check_data_validity</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">is_data</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">on_select_data</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                </div>
+<div class="viewcode-block" id="FitPage.on_select_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.on_select_data">[docs]</a>    <span class="k">def</span> <span class="nf">on_select_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On_select_data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">GetCount</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+            <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_on_fit_complete</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        When fit is complete ,reset the fit button label.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_started</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_fitbutton</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_is_2D</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check if data_name is Data2D</span>
+<span class="sd">        </span>
+<span class="sd">        :return: True or False</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                        <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">True</span>
+        <span class="k">return</span> <span class="bp">False</span>
+            
+    <span class="k">def</span> <span class="nf">_on_engine_change</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get the current name of the fit engine type</span>
+<span class="sd">         and update the panel accordingly</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">engine_type</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">engine_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine_type</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+                <span class="k">return</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_fill_range_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the sizer containing the plotting range</span>
+<span class="sd">        add  access to npts</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">is_2Ddata</span> <span class="o">=</span> <span class="bp">False</span>
+        
+        <span class="c"># Check if data is 2D</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                        <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+            <span class="n">is_2Ddata</span> <span class="o">=</span> <span class="bp">True</span>
+            
+        <span class="n">title</span> <span class="o">=</span> <span class="s">&quot;Fitting&quot;</span>
+        <span class="c">#smear messages &amp; titles</span>
+        <span class="n">smear_message_none</span> <span class="o">=</span> <span class="s">&quot;No smearing is selected...&quot;</span>
+        <span class="n">smear_message_dqdata</span> <span class="o">=</span> <span class="s">&quot;The dQ data is being used for smearing...&quot;</span>
+        <span class="n">smear_message_2d</span> <span class="o">=</span> \
+              <span class="s">&quot;Higher accuracy is very time-expensive. Use it with care...&quot;</span>
+        <span class="n">smear_message_new_ssmear</span> <span class="o">=</span> \
+              <span class="s">&quot;Please enter only the value of interest to customize smearing...&quot;</span>
+        <span class="n">smear_message_new_psmear</span> <span class="o">=</span> \
+              <span class="s">&quot;Please enter both; the dQ will be generated by interpolation...&quot;</span>
+        <span class="n">smear_message_2d_x_title</span> <span class="o">=</span> <span class="s">&quot;&lt;dQp&gt;[1/A]:&quot;</span>
+        <span class="n">smear_message_2d_y_title</span> <span class="o">=</span> <span class="s">&quot;&lt;dQs&gt;[1/A]:&quot;</span>
+        <span class="n">smear_message_pinhole_min_title</span> <span class="o">=</span> <span class="s">&quot;dQ_low[1/A]:&quot;</span>
+        <span class="n">smear_message_pinhole_max_title</span> <span class="o">=</span> <span class="s">&quot;dQ_high[1/A]:&quot;</span>
+        <span class="n">smear_message_slit_height_title</span> <span class="o">=</span> <span class="s">&quot;Slit height[1/A]:&quot;</span>
+        <span class="n">smear_message_slit_width_title</span> <span class="o">=</span> <span class="s">&quot;Slit width[1/A]:&quot;</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_get_smear_info</span><span class="p">()</span>
+        
+        <span class="c">#Sizers</span>
+        <span class="n">box_description_range</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">title</span><span class="p">))</span>
+        <span class="n">box_description_range</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">BLUE</span><span class="p">)</span>
+        <span class="n">boxsizer_range</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">box_description_range</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</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>
+        <span class="n">sizer_smearer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_masking</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>
+        <span class="n">sizer_chi2</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>
+        <span class="n">smear_set_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Set Instrumental Smearing&#39;</span><span class="p">)</span>
+        <span class="n">sizer_smearer_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">smear_set_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
+        <span class="n">sizer_smearer_box</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_DATA_BOX_WIDTH</span><span class="p">,</span> <span class="mi">60</span><span class="p">))</span>
+        
+        <span class="n">weighting_set_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> \
+                                <span class="s">&#39;Set Weighting by Selecting dI Source&#39;</span><span class="p">)</span>
+        <span class="n">weighting_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">weighting_set_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
+        <span class="n">sizer_weighting</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>
+        <span class="n">weighting_box</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_DATA_BOX_WIDTH</span><span class="p">,</span> <span class="mi">40</span><span class="p">))</span>
+        <span class="c">#Filling the sizer containing weighting info.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;No Weighting&#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">RB_GROUP</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Use dI Data&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Use |sqrt(I Data)|&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Use |I Data|&#39;</span><span class="p">)</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onWeighting</span><span class="p">,</span>
+                  <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onWeighting</span><span class="p">,</span>
+                  <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onWeighting</span><span class="p">,</span>
+                  <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onWeighting</span><span class="p">,</span>
+                  <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="c"># add 4 types of weighting to the sizer</span>
+        <span class="n">sizer_weighting</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">sizer_weighting</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">14</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">sizer_weighting</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="p">)</span>
+        <span class="n">sizer_weighting</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">14</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">sizer_weighting</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="p">)</span>
+        <span class="n">sizer_weighting</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">14</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">sizer_weighting</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="p">)</span>
+        <span class="n">sizer_weighting</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">weighting_box</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_weighting</span><span class="p">)</span>
+        
+        <span class="n">sizer_fit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridSizer</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
+        
+        <span class="c"># combobox for smear2d accuracy selection</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_accuracy</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_accuracy_list</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_accuracy</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear2d_accuracy</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_accuracy</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_accuracy</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+            <span class="s">&quot;&#39;Higher&#39; uses more Gaussian points for smearing computation.&quot;</span><span class="p">)</span>
+                   
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_accuracy</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_accuracy</span><span class="p">)</span>
+
+        <span class="c">#Fit button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span> <span class="s">&#39;Fit&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">88</span><span class="p">,</span> <span class="mi">25</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">default_bt_colour</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">GetDefaultAttributes</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onFit</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Start fitting.&quot;</span><span class="p">)</span>
+        
+        <span class="c">#textcntrl for custom resolution</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">-</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                            <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                            <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">onPinholeSmear</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">-</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                            <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                            <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">onPinholeSmear</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">-</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                            <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                            <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">onSlitSmear</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">-</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                            <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                            <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">onSlitSmear</span><span class="p">)</span>
+
+        <span class="c">## smear</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_left</span> <span class="o">=</span> <span class="n">BGTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">-</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_left</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dq_l</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_right</span> <span class="o">=</span> <span class="n">BGTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                        <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">-</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_right</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dq_r</span><span class="p">))</span>
+
+        <span class="c">#set default values for smear</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_max</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_min</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dxl</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dxw</span><span class="p">))</span>
+
+        <span class="c">#Filling the sizer containing instruments smearing info.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="s">&#39;None&#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">RB_GROUP</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                             <span class="s">&#39;Use dQ Data&#39;</span><span class="p">)</span>
+        <span class="c">#self.enable_smearer.SetToolTipString(</span>
+        <span class="c">#&quot;Click to use the loaded dQ data for smearing.&quot;)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="s">&#39;Custom Pinhole Smear&#39;</span><span class="p">)</span>
+        <span class="c">#self.pinhole_smearer.SetToolTipString</span>
+        <span class="c">#(&quot;Click to input custom resolution for pinhole smearing.&quot;)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Custom Slit Smear&#39;</span><span class="p">)</span>
+        <span class="c">#self.slit_smearer.SetToolTipString</span>
+        <span class="c">#(&quot;Click to input custom resolution for slit smearing.&quot;)</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onSmear</span><span class="p">,</span>
+                  <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onSmear</span><span class="p">,</span>
+                  <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onPinholeSmear</span><span class="p">,</span>
+                  <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onSlitSmear</span><span class="p">,</span>
+                  <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+        <span class="c"># add 4 types of smearing to the sizer</span>
+        <span class="n">sizer_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">sizer_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">sizer_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="p">)</span>
+        <span class="n">sizer_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">sizer_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="p">)</span>
+        <span class="n">sizer_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">sizer_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="p">)</span>
+        <span class="n">sizer_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        
+        <span class="c"># StaticText for chi2, N(for fitting), Npts + Log/linear spacing</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span> <span class="o">=</span> <span class="n">BGTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;-&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">75</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Chi2/Npts(Fit)&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span> <span class="o">=</span> <span class="n">BGTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;-&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">75</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+                            <span class="s">&quot; Npts : number of points selected for fitting&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                        <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                        <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                        <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onQrangeEnter</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+                                <span class="s">&quot; Total Npts : total number of data points&quot;</span><span class="p">)</span>
+                
+        <span class="c"># Update and Draw button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span>
+                                     <span class="s">&#39;Compute&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">88</span><span class="p">,</span> <span class="mi">24</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_button</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_BUTTON</span><span class="p">,</span> \
+                              <span class="bp">self</span><span class="o">.</span><span class="n">_onDraw</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Compute and Draw.&quot;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">points_sizer</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> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">pointsbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Log?&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pointsbox</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pointsbox</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Check mark to use log spaced points&quot;</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="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">pointsbox</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">select_log</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">points_sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Npts    &#39;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">points_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pointsbox</span><span class="p">)</span>
+
+        <span class="n">box_description_1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;   Chi2/Npts&#39;</span><span class="p">)</span>
+        <span class="n">box_description_2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Npts(Fit)&#39;</span><span class="p">)</span>
+        <span class="c">#box_description_3 = wx.StaticText(self, -1, &#39;Total Npts&#39;)</span>
+        <span class="c">#box_description_3.SetToolTipString( \</span>
+        <span class="c">#                        &quot; Total Npts : total number of data points&quot;)</span>
+        
+        <span class="n">sizer_fit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">box_description_1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_fit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">box_description_2</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_fit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">points_sizer</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="c">#sizer_fit.Add(box_description_3, 0, 0)</span>
+        <span class="n">sizer_fit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">draw_button</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_fit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_fit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_fit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_fit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+
+        <span class="c"># StaticText for smear</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_none</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                    <span class="n">smear_message_none</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_dqdata</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
+                                <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">smear_message_dqdata</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_type</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
+                                     <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Type:&quot;</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_accuracy_type</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                        <span class="s">&quot;Accuracy:&quot;</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_smear_type</span> <span class="o">=</span> <span class="n">BGTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                       <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">57</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_smear_type</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dq_l</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetParent</span><span class="p">()</span><span class="o">.</span><span class="n">GetBackgroundColour</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                    <span class="n">smear_message_2d</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_message_new_s</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                         <span class="n">smear_message_new_ssmear</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_message_new_p</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                            <span class="n">smear_message_new_psmear</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d_x</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                            <span class="n">smear_message_2d_x_title</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d_x</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+                                        <span class="s">&quot;  dQp(parallel) in q_r direction.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d_y</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                            <span class="n">smear_message_2d_y_title</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d_y</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+                                    <span class="s">&quot; dQs(perpendicular) in q_phi direction.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_pin_min</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                        <span class="n">smear_message_pinhole_min_title</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_pin_max</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                        <span class="n">smear_message_pinhole_max_title</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_slit_height</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                        <span class="n">smear_message_slit_height_title</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_slit_width</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                        <span class="n">smear_message_slit_width_title</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">ALIGN_LEFT</span><span class="p">)</span>
+        
+        <span class="c">#arrange sizers</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_smearer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_none</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_dqdata</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_type</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_accuracy_type</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_accuracy</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_smear_type</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">15</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d_x</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_pin_min</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_slit_height</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_min</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_data_left</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d_y</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">CENTER</span><span class="p">,</span> <span class="mi">10</span> <span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_pin_max</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">CENTER</span><span class="p">,</span> <span class="mi">10</span> <span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_description_slit_width</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">CENTER</span><span class="p">,</span> <span class="mi">10</span> <span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_max</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_data_right</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+           
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_message_new_s</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_message_new_p</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</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">2</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer_new_smear</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">CENTER</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+        <span class="c"># add all to chi2 sizer</span>
+        <span class="n">sizer_smearer_box</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="p">)</span>
+        <span class="n">sizer_chi2</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_smearer_box</span><span class="p">)</span>
+        <span class="n">sizer_chi2</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="n">sizer_chi2</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">weighting_box</span><span class="p">)</span>
+        <span class="n">sizer_chi2</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        
+        <span class="c"># hide all smear messages and textctrl</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_hide_all_smear_info</span><span class="p">()</span>
+        
+        <span class="c"># get smear_selection</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">=</span> <span class="n">smear_selection</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+
+        <span class="c"># Show only the relevant smear messages, etc</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">is_2Ddata</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_none</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_none</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_show_smear_sizer</span><span class="p">()</span>
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_masking</span><span class="p">)</span>
+        <span class="c">#2D data? default</span>
+        <span class="n">is_2Ddata</span> <span class="o">=</span> <span class="bp">False</span>
+        
+        <span class="c">#check if it is 2D data</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+            <span class="n">is_2Ddata</span> <span class="o">=</span> <span class="bp">True</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer5</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+     
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                    <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                    <span class="n">set_focus_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">qrang_set_focus</span><span class="p">,</span>
+                                    <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onQrangeEnter</span><span class="p">,</span>
+                                    <span class="n">name</span><span class="o">=</span><span class="s">&#39;qmin&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">))</span>
+        <span class="n">q_tip</span> <span class="o">=</span> <span class="s">&quot;Click outside of the axes</span><span class="se">\n</span><span class="s"> to remove the lines.&quot;</span>
+        <span class="n">qmin_tip</span> <span class="o">=</span> <span class="s">&quot;Minimun value of Q.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">qmin_tip</span> <span class="o">+=</span> <span class="n">q_tip</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">qmin_tip</span><span class="p">)</span>
+     
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                       <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                       <span class="n">set_focus_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">qrang_set_focus</span><span class="p">,</span>
+                                       <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onQrangeEnter</span><span class="p">,</span>
+                                       <span class="n">name</span><span class="o">=</span><span class="s">&#39;qmax&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">))</span>
+        <span class="n">qmax_tip</span> <span class="o">=</span> <span class="s">&quot;Maximum value of Q.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">qmax_tip</span> <span class="o">+=</span> <span class="n">q_tip</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">qmax_tip</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</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_MOUSE_EVENTS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qrange_click</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</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_MOUSE_EVENTS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qrange_click</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</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_KEY_DOWN</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_key</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</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_KEY_DOWN</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_key</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_qrange_text</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_qrange_text</span><span class="p">)</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_qrange</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&#39;Reset&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">77</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+      
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_qrange</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_reset_clicked</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_qrange</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Reset Q range to the default&quot;</span><span class="p">)</span>
+     
+        <span class="n">sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridSizer</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span> <span class="s">&#39;Editor&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">88</span><span class="p">,</span> <span class="mi">23</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onMask</span><span class="p">,</span>
+                             <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Edit Mask.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39; Masking(2D)&#39;</span><span class="p">)</span>
+        
+        <span class="n">sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;   Q range&#39;</span><span class="p">))</span>
+        <span class="n">sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39; Min[1/A]&#39;</span><span class="p">))</span>
+        <span class="n">sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39; Max[1/A]&#39;</span><span class="p">))</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">reset_qrange</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+        <span class="c">#sizer.Add(self.theory_npts_tcrtl)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="p">)</span>
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_chi2</span><span class="p">)</span>
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer</span><span class="p">)</span>
+        
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">15</span><span class="p">))</span>
+        <span class="n">boxsizer_range</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_fit</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">is_2Ddata</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="c">## save state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer5</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer_range</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer5</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+
+        
+    <span class="k">def</span> <span class="nf">_set_sizer_dispersion</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        draw sizer with gaussian dispersity parameters</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span> <span class="o">=</span> <span class="p">[]</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c">##no model is selected</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="c">## the user didn&#39;t select dispersity display</span>
+            <span class="k">return</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_dispersity</span><span class="p">()</span>
+        
+        <span class="c">## fill a sizer with the combobox to select dispersion type</span>
+        <span class="n">model_disp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Function&#39;</span><span class="p">)</span>
+        <span class="n">CHECK_STATE</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="kn">import</span> <span class="nn">sas.models.dispersion_models</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">polydisp</span> <span class="o">=</span> <span class="n">sas</span><span class="o">.</span><span class="n">models</span><span class="o">.</span><span class="n">dispersion_models</span><span class="o">.</span><span class="n">models</span>
+
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">disp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39; &#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">disp</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                          <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">values</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;PD[ratio]&#39;</span><span class="p">)</span>
+        <span class="n">polytext</span> <span class="o">=</span> <span class="s">&quot;Polydispersity (= STD/mean); &quot;</span>
+        <span class="n">polytext</span> <span class="o">+=</span> <span class="s">&quot;the standard deviation over the mean value.&quot;</span>
+        <span class="n">values</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">polytext</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">values</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">2</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+            <span class="n">err_text</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">err_text</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">text_disp_1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">err_text</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">text_disp_1</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">text_disp_min</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Min&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">text_disp_min</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">text_disp_max</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Max&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">text_disp_max</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+       
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">npts</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Npts&#39;</span><span class="p">)</span>
+        <span class="n">npts</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Number of sampling points for the numerical</span><span class="se">\n\</span>
+<span class="s">        integration over the distribution function.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">npts</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">nsigmas</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Nsigs&#39;</span><span class="p">)</span>
+        <span class="n">nsigmas</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Number of sigmas between which the range</span><span class="se">\n\</span>
+<span class="s">         of the distribution function will be used for weighting. </span><span class="se">\n\</span>
+<span class="s">        The value &#39;3&#39; covers 99.5</span><span class="si">% f</span><span class="s">or Gaussian distribution </span><span class="se">\n\</span>
+<span class="s">        function. Note: Not recommended to change this value.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">nsigmas</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">model_disp</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">text_disp_max</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">text_disp_min</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+                    <span class="k">continue</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">name0</span> <span class="o">=</span> <span class="s">&quot;Distribution of &quot;</span> <span class="o">+</span> <span class="n">item</span>
+                <span class="n">name1</span> <span class="o">=</span> <span class="n">item</span> <span class="o">+</span> <span class="s">&quot;.width&quot;</span>
+                <span class="n">name2</span> <span class="o">=</span> <span class="n">item</span> <span class="o">+</span> <span class="s">&quot;.npts&quot;</span>
+                <span class="n">name3</span> <span class="o">=</span> <span class="n">item</span> <span class="o">+</span> <span class="s">&quot;.nsigmas&quot;</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">name1</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">name1</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>
+
+                <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+                <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">item</span><span class="p">]</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+        
+                    <span class="k">if</span> <span class="n">p</span> <span class="o">==</span> <span class="s">&quot;width&quot;</span><span class="p">:</span>
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+                        <span class="n">cb</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">name0</span><span class="p">,</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+                        <span class="n">cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">CHECK_STATE</span><span class="p">)</span>
+                        <span class="n">cb</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Check mark to fit&quot;</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="bp">self</span><span class="p">,</span> <span class="n">cb</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">select_param</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">cb</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">1</span>
+                        <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">name1</span><span class="p">)</span>
+                        <span class="n">ctl1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">1.3</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                  <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+                        <span class="n">ctl1</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&#39;PD[ratio]&#39;</span><span class="p">)</span>
+                        <span class="n">poly_text</span> <span class="o">=</span> <span class="s">&quot;Polydispersity (STD/mean) of </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">item</span>
+                        <span class="n">poly_text</span> <span class="o">+=</span> <span class="s">&quot;STD: the standard deviation&quot;</span>
+                        <span class="n">poly_text</span> <span class="o">+=</span> <span class="s">&quot; from the mean value.&quot;</span>
+                        <span class="n">ctl1</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">poly_text</span><span class="p">)</span>
+                        <span class="n">ctl1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="bp">True</span><span class="p">)))</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl1</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+                        <span class="c">## text to show error sign</span>
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">2</span>
+                        <span class="n">text2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;+/-&#39;</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">text2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+                            <span class="n">text2</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">3</span>
+                        <span class="n">ctl2</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">1.3</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                           <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+                  
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+                            <span class="n">ctl2</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">4</span>
+                        <span class="n">ctl3</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                  <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onparamRangeEnter</span><span class="p">)</span>
+                        
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl3</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                       
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">5</span>
+                        <span class="n">ctl4</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                  <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                            <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onparamRangeEnter</span><span class="p">)</span>
+                        
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl4</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+
+                        <span class="n">ctl3</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                        <span class="n">ctl4</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                                                              
+                    <span class="k">elif</span> <span class="n">p</span> <span class="o">==</span> <span class="s">&quot;npts&quot;</span><span class="p">:</span>
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">6</span>
+                        <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">name2</span><span class="p">)</span>
+                        <span class="n">Tctl</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">2.2</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                  <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+                        
+                        <span class="n">Tctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">Tctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                           <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="bp">None</span><span class="p">,</span> <span class="n">name2</span><span class="p">,</span> <span class="n">Tctl</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span>
+                                                 <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">])</span>
+                    <span class="k">elif</span> <span class="n">p</span> <span class="o">==</span> <span class="s">&quot;nsigmas&quot;</span><span class="p">:</span>
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">7</span>
+                        <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">name3</span><span class="p">)</span>
+                        <span class="n">Tct2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">2.2</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                  <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+                        
+                        <span class="n">Tct2</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">Tct2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                           <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="bp">None</span><span class="p">,</span> <span class="n">name3</span><span class="p">,</span> <span class="n">Tct2</span><span class="p">,</span>
+                                                 <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span>
+                                                 <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">])</span>
+
+                <span class="n">ix</span> <span class="o">=</span> <span class="mi">8</span>
+                <span class="n">disp_box</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">65</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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> <span class="n">name</span><span class="o">=</span><span class="s">&#39;</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">name1</span><span class="p">)</span>
+                <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">polydisp</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                    <span class="n">name_disp</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
+                    <span class="n">disp_box</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">name_disp</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+                    <span class="n">disp_box</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="s">&quot;gaussian&quot;</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="n">disp_box</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_disp_func</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">disp_box</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">cb</span><span class="p">,</span> <span class="n">name1</span><span class="p">,</span> <span class="n">ctl1</span><span class="p">,</span> <span class="n">text2</span><span class="p">,</span>
+                                            <span class="n">ctl2</span><span class="p">,</span> <span class="n">ctl3</span><span class="p">,</span> <span class="n">ctl4</span><span class="p">,</span> <span class="n">disp_box</span><span class="p">])</span>
+                           
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                          <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">first_orient</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+                    <span class="k">continue</span>
+            <span class="k">if</span>  <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">name0</span> <span class="o">=</span> <span class="s">&quot;Distribution of &quot;</span> <span class="o">+</span> <span class="n">item</span>
+                <span class="n">name1</span> <span class="o">=</span> <span class="n">item</span> <span class="o">+</span> <span class="s">&quot;.width&quot;</span>
+                <span class="n">name2</span> <span class="o">=</span> <span class="n">item</span> <span class="o">+</span> <span class="s">&quot;.npts&quot;</span>
+                <span class="n">name3</span> <span class="o">=</span> <span class="n">item</span> <span class="o">+</span> <span class="s">&quot;.nsigmas&quot;</span>
+                
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">name1</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">name1</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>
+ 
+                <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+                <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">item</span><span class="p">]</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+        
+                    <span class="k">if</span> <span class="n">p</span> <span class="o">==</span> <span class="s">&quot;width&quot;</span><span class="p">:</span>
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+                        <span class="n">cb</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">name0</span><span class="p">,</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+                        <span class="n">cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">CHECK_STATE</span><span class="p">)</span>
+                        <span class="n">cb</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Check mark to fit&quot;</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="bp">self</span><span class="p">,</span> <span class="n">cb</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">select_param</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">cb</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+                        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                            <span class="n">cb</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                        <span class="k">elif</span> <span class="n">cb</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                            <span class="n">cb</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">1</span>
+                        <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">name1</span><span class="p">)</span>
+                        <span class="n">ctl1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">1.3</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                  <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+                        <span class="n">poly_tip</span> <span class="o">=</span> <span class="s">&quot;Absolute Sigma for </span><span class="si">%s</span><span class="s">.&quot;</span> <span class="o">%</span> <span class="n">item</span>
+                        <span class="n">ctl1</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">poly_tip</span><span class="p">)</span>
+                        <span class="n">ctl1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="bp">True</span><span class="p">)))</span>
+                        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                            <span class="k">if</span> <span class="n">first_orient</span><span class="p">:</span>
+                                <span class="n">values</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&#39;PD[ratio], Sig[deg]&#39;</span><span class="p">)</span>
+                                <span class="n">poly_text</span> <span class="o">=</span> <span class="s">&quot;PD(polydispersity for lengths):</span><span class="se">\n</span><span class="s">&quot;</span>
+                                <span class="n">poly_text</span> <span class="o">+=</span> <span class="s">&quot;It should be a value between&quot;</span>
+                                <span class="n">poly_text</span> <span class="o">+=</span> <span class="s">&quot;0 and 1</span><span class="se">\n</span><span class="s">&quot;</span>
+                                <span class="n">poly_text</span> <span class="o">+=</span> <span class="s">&quot;Sigma for angles: </span><span class="se">\n</span><span class="s">&quot;</span>
+                                <span class="n">poly_text</span> <span class="o">+=</span> <span class="s">&quot;It is the STD (ratio*mean)&quot;</span>
+                                <span class="n">poly_text</span> <span class="o">+=</span> <span class="s">&quot; of the distribution.</span><span class="se">\n</span><span class="s"> &quot;</span>
+                            
+                                <span class="n">values</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">poly_text</span><span class="p">)</span>
+                                <span class="n">first_orient</span> <span class="o">=</span> <span class="bp">False</span>
+                            <span class="n">ctl1</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                        <span class="k">elif</span> <span class="n">ctl1</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                            <span class="n">ctl1</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                        
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl1</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+                        <span class="c">## text to show error sign</span>
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">2</span>
+                        <span class="n">text2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;+/-&#39;</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">text2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+
+                        <span class="n">text2</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">3</span>
+                        <span class="n">ctl2</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">1.3</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                           <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+                    
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+
+                        <span class="n">ctl2</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                                <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+                                <span class="n">text2</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                                <span class="n">ctl2</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                            
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">4</span>
+                        <span class="n">ctl3</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                  <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onparamRangeEnter</span><span class="p">)</span>
+
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl3</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+
+                        <span class="n">ctl3</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">5</span>
+                        <span class="n">ctl4</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                            <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                            <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                            <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onparamRangeEnter</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl4</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                        <span class="n">ctl4</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                        
+                        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                                <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                            <span class="n">ctl3</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                            <span class="n">ctl4</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                             
+                    <span class="k">elif</span> <span class="n">p</span> <span class="o">==</span> <span class="s">&quot;npts&quot;</span><span class="p">:</span>
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">6</span>
+                        <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">name2</span><span class="p">)</span>
+                        <span class="n">Tctl</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">2.2</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                 <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+                        
+                        <span class="n">Tctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span>
+                        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                                <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                            <span class="n">Tctl</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="n">Tctl</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">Tctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="bp">None</span><span class="p">,</span> <span class="n">name2</span><span class="p">,</span> <span class="n">Tctl</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span>
+                                                 <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">])</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="bp">None</span><span class="p">,</span> <span class="n">name2</span><span class="p">,</span>
+                                                             <span class="n">Tctl</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span>
+                                                             <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">])</span>
+                    <span class="k">elif</span> <span class="n">p</span> <span class="o">==</span> <span class="s">&quot;nsigmas&quot;</span><span class="p">:</span>
+                        <span class="n">ix</span> <span class="o">=</span> <span class="mi">7</span>
+                        <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">name3</span><span class="p">)</span>
+                        <span class="n">Tct2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">2.2</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                  <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+                        
+                        <span class="n">Tct2</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span>
+                        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                                <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                            <span class="n">Tct2</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="n">Tct2</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">Tct2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+
+                        <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="bp">None</span><span class="p">,</span> <span class="n">name3</span><span class="p">,</span> <span class="n">Tct2</span><span class="p">,</span>
+                                                 <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">])</span>
+                                                   
+                        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="bp">None</span><span class="p">,</span> <span class="n">name3</span><span class="p">,</span>
+                                        <span class="n">Tct2</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">])</span>
+
+                <span class="n">ix</span> <span class="o">=</span> <span class="mi">8</span>
+                <span class="n">disp_box</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">65</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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> <span class="n">name</span><span class="o">=</span><span class="s">&#39;</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">name1</span><span class="p">)</span>
+                <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">polydisp</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                    <span class="n">name_disp</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
+                    <span class="n">disp_box</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">name_disp</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+                    <span class="n">disp_box</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="s">&quot;gaussian&quot;</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="n">disp_box</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_disp_func</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sizer4_4</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">disp_box</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">cb</span><span class="p">,</span> <span class="n">name1</span><span class="p">,</span> <span class="n">ctl1</span><span class="p">,</span> <span class="n">text2</span><span class="p">,</span>
+                                            <span class="n">ctl2</span><span class="p">,</span> <span class="n">ctl3</span><span class="p">,</span> <span class="n">ctl4</span><span class="p">,</span> <span class="n">disp_box</span><span class="p">])</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">cb</span><span class="p">,</span> <span class="n">name1</span><span class="p">,</span> <span class="n">ctl1</span><span class="p">,</span>
+                                            <span class="n">text2</span><span class="p">,</span> <span class="n">ctl2</span><span class="p">,</span> <span class="n">ctl3</span><span class="p">,</span> <span class="n">ctl4</span><span class="p">,</span> <span class="n">disp_box</span><span class="p">])</span>
+                       
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                                <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                    <span class="n">disp_box</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">disp_box</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disp_cb_dict</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="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">)</span>
+          
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="c">## save state into</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">cb1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">,</span>
+                                     <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">,</span>
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">)</span>
+
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot; Selected Distribution: Gaussian&quot;</span><span class="p">))</span>
+        <span class="c">#Fill the list of fittable parameters</span>
+        <span class="c">#self.select_all_param(event=None)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">get_all_checked_params</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+
+    <span class="k">def</span> <span class="nf">_onDraw</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Update and Draw the model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please select a Model first...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="k">return</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        if not self.data.is_data:</span>
+<span class="sd">            self.npts_x = self.Npts_total.GetValue()</span>
+<span class="sd">            self.Npts_fit.SetValue(self.npts_x)</span>
+<span class="sd">            self.create_default_data()</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_update_paramv_on_fit</span><span class="p">()</span>
+    
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_onparamEnter_helper</span><span class="p">)</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;The parameters are invalid&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+            <span class="k">return</span>
+        
+    <span class="k">def</span> <span class="nf">_onFit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Allow to fit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_started</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_StopFit</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_started</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">set_fitbutton</span><span class="p">)</span>
+            <span class="k">return</span>
+
+        <span class="k">if</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">fit_thread_list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span>
+                <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">_fit_engine</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="s">&quot;park&quot;</span><span class="p">,</span><span class="s">&quot;bumps&quot;</span><span class="p">)</span>
+                <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">sim_page</span> <span class="o">!=</span> <span class="bp">None</span>
+                <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">uid</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">):</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;The FitEnging will be set to &#39;ParkMC&#39;</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; to fit with more than one data set...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please get Data first...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Fit: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">msg</span><span class="p">))</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please select a Model first...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Fit: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+            <span class="k">return</span>
+        
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">)</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Select at least one parameter to fit&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+            <span class="k">return</span>
+        
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_update_paramv_on_fit</span><span class="p">()</span>
+        
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_Npts_1D</span><span class="p">():</span>
+                <span class="k">return</span>
+                
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fitting range or parameters are invalid&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+            <span class="k">return</span>
+              
+        <span class="bp">self</span><span class="o">.</span><span class="n">select_param</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+
+        <span class="c"># Remove or do not allow fitting on the Q=0 point, especially</span>
+        <span class="c"># when y(q=0)=None at x[0].</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">_reset_schedule_problem</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">schedule_for_fit</span><span class="p">(</span><span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_fit_range</span><span class="p">(</span><span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span> <span class="n">qmin</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">,</span>
+                                    <span class="n">qmax</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">)</span>
+
+        <span class="c">#single fit</span>
+        <span class="c">#self._manager.onFit(uid=self.uid)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_started</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">onFit</span><span class="p">(</span><span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">set_fitbutton</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="FitPage.set_fitbutton"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.set_fitbutton">[docs]</a>    <span class="k">def</span> <span class="nf">set_fitbutton</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set fit button label depending on the fit_started[bool]</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Skip this feature if we are not on Windows</span>
+        <span class="c">#NOTE: the is_mac data member actually means &quot;is no Windows&quot;.</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+            <span class="k">return</span>
+        
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_started</span><span class="p">:</span>
+            <span class="n">label</span> <span class="o">=</span> <span class="s">&quot;Stop&quot;</span>
+            <span class="n">color</span> <span class="o">=</span> <span class="s">&quot;red&quot;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">label</span> <span class="o">=</span> <span class="s">&quot;Fit&quot;</span>
+            <span class="n">color</span> <span class="o">=</span> <span class="s">&quot;black&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">label</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">color</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                     </div>
+<div class="viewcode-block" id="FitPage.get_weight_flag"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.get_weight_flag">[docs]</a>    <span class="k">def</span> <span class="nf">get_weight_flag</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get flag corresponding to a given weighting dI data.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">button_list</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="p">,</span>
+                       <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="p">,</span>
+                       <span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="p">,</span>
+                       <span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="p">]</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">button_list</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">button_list</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">item</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="mi">0</span>  <span class="c"># dy = numpy.ones_like(dy_data)</span>
+                <span class="k">elif</span> <span class="n">button_list</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">item</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="mi">1</span>  <span class="c"># dy = dy_data</span>
+                <span class="k">elif</span> <span class="n">button_list</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">item</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="mi">2</span>  <span class="c"># dy = numpy.sqrt(numpy.abs(data))</span>
+                <span class="k">elif</span> <span class="n">button_list</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">item</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
+                    <span class="n">flag</span> <span class="o">=</span> <span class="mi">3</span>  <span class="c"># dy = numpy.abs(data)</span>
+                <span class="k">break</span>
+        <span class="k">return</span> <span class="n">flag</span>
+                </div>
+    <span class="k">def</span> <span class="nf">_StopFit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Stop fit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">stop_fit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">_reset_schedule_problem</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_fit_complete</span><span class="p">()</span>
+         
+<div class="viewcode-block" id="FitPage.rename_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.rename_model">[docs]</a>    <span class="k">def</span> <span class="nf">rename_model</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        find a short name for model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;M&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">index_model</span><span class="p">)</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_on_select_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        call back for model selection</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">copy_flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">is_poly_enabled</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span>\
+                        <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&#39;None&#39;</span><span class="p">)</span>\
+                        <span class="ow">or</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span>\
+                        <span class="ow">or</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">multifactorbox</span><span class="p">:</span>
+                <span class="n">copy_flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_copy_params</span><span class="p">()</span>
+                <span class="n">is_poly_enabled</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_model_helper</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_model_param_sizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_keep</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_dispers_sizer</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable_disp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disable_disp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">pinhole_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">slit_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+    
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">structurecombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">formfactorcombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_fit_button</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">m_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">m_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">m_name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">rename_model</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_copy_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_paste_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">is_data</span> <span class="o">=</span> <span class="n">check_data_validity</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">is_data</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_keep</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="c"># Reset smearer, model and data</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">copy_flag</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+    
+            <span class="c"># more disables for 2D</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_smear_buttons</span><span class="p">()</span>
+            
+            <span class="k">try</span><span class="p">:</span>
+                <span class="c"># update smearer sizer</span>
+                <span class="c">#if not self.enable_smearer.GetValue():</span>
+                <span class="c">#    self.disable_smearer.SetValue(True)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">onSmear</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+                <span class="n">temp_smear</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                    <span class="c"># Set the smearer environments</span>
+                    <span class="n">temp_smear</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">raise</span>
+                <span class="c">## error occured on chisqr computation</span>
+                <span class="c">#pass</span>
+            <span class="c">## event to post model to fit to fitting plugins</span>
+            <span class="p">(</span><span class="n">ModelEventbox</span><span class="p">,</span> <span class="n">EVT_MODEL_BOX</span><span class="p">)</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">newevent</span><span class="o">.</span><span class="n">NewEvent</span><span class="p">()</span>
+         
+            <span class="c">## set smearing value whether or not</span>
+            <span class="c">#    the data contain the smearing info</span>
+            <span class="n">evt</span> <span class="o">=</span> <span class="n">ModelEventbox</span><span class="p">(</span><span class="n">model</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">,</span>
+                            <span class="n">smearer</span><span class="o">=</span><span class="n">temp_smear</span><span class="p">,</span>
+                            <span class="n">enable_smearer</span><span class="o">=</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">(),</span>
+                            <span class="n">qmin</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">),</span>
+                            <span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span>
+                            <span class="n">caption</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">window_caption</span><span class="p">,</span>
+                            <span class="n">qmax</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">))</span>
+   
+            <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">_on_model_panel</span><span class="p">(</span><span class="n">evt</span><span class="o">=</span><span class="n">evt</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">mbox_description</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;Model [ </span><span class="si">%s</span><span class="s"> ]&quot;</span><span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">mbox_description</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">BLUE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span>
+
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c">## post state to fit panel</span>
+            <span class="n">new_event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">new_event</span><span class="p">)</span>
+            <span class="c">#update list of plugins if new plugin is available</span>
+            <span class="n">custom_model</span> <span class="o">=</span> <span class="s">&#39;Customized Models&#39;</span>
+            <span class="n">mod_cat</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">GetStringSelection</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">mod_cat</span> <span class="o">==</span> <span class="n">custom_model</span><span class="p">:</span>
+                <span class="n">temp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_model_list</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">temp</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="n">temp</span>
+                    <span class="n">current_val</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+                    <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_show_combox_helper</span><span class="p">()</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">current_val</span><span class="p">)</span>
+            <span class="c"># when select a model only from guictr/button</span>
+            <span class="k">if</span> <span class="n">is_poly_enabled</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">is_poly_enabled</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="ow">not</span> <span class="n">is_poly_enabled</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_dipers_Param</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable_disp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disable_disp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+
+            <span class="c"># Keep the previous param values</span>
+            <span class="k">if</span> <span class="n">copy_flag</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">get_paste_params</span><span class="p">(</span><span class="n">copy_flag</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_onDraw</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+                
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+            
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+         
+    <span class="k">def</span> <span class="nf">_onparamEnter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        when enter value on panel redraw model according to changed</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please select a Model first...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="k">return</span>
+
+        <span class="c">#default flag</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c">#get event object</span>
+        <span class="n">tcrtl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="c">#Clear msg if previously shown.</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+
+        <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="n">tcrtl</span><span class="p">):</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onparamEnter_helper</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">show_npts2fit</span><span class="p">()</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fitrange</span><span class="p">:</span>
+                <span class="n">temp_smearer</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                    <span class="n">temp_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span>
+                    <span class="c">## set smearing value whether or not</span>
+                    <span class="c">#        the data contain the smearing info</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                        <span class="n">flag1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">update_slit_smear</span><span class="p">()</span>
+                        <span class="n">flag</span> <span class="o">=</span> <span class="n">flag</span> <span class="ow">or</span> <span class="n">flag1</span>
+                    <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                        <span class="n">flag1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">update_pinhole_smear</span><span class="p">()</span>
+                        <span class="n">flag</span> <span class="o">=</span> <span class="n">flag</span> <span class="ow">or</span> <span class="n">flag1</span>
+                <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">and</span> \
+                        <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_smearer</span><span class="p">(</span><span class="n">smearer</span><span class="o">=</span><span class="n">temp_smearer</span><span class="p">,</span>
+                                              <span class="n">fid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
+                                              <span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span>
+                                              <span class="n">qmin</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">),</span>
+                                              <span class="n">qmax</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">),</span>
+                            <span class="n">enable_smearer</span><span class="o">=</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">(),</span>
+                                            <span class="n">draw</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">flag</span><span class="p">:</span>
+                    <span class="c">#self.compute_chisqr(smearer= temp_smearer)</span>
+        
+                    <span class="c">## new state posted</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_change</span><span class="p">:</span>
+                        <span class="c">#self._undo.Enable(True)</span>
+                        <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">state_change</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="c"># invalid fit range: do nothing here:</span>
+                <span class="c"># msg already displayed in validate</span>
+                <span class="k">return</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Cannot Plot :Must enter a number!!!  &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+             
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="k">return</span>
+   
+    <span class="k">def</span> <span class="nf">_onparamRangeEnter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check validity of value enter in the parameters range field</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">tcrtl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="c">#Clear msg if previously shown.</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="c"># Flag to register when a parameter has changed.</span>
+        <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="n">tcrtl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_check_value_enter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">,</span> <span class="n">is_modified</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_check_value_enter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">,</span> <span class="n">is_modified</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error:wrong value entered : </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                <span class="k">return</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+           
+        <span class="c">#self._undo.Enable(True)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_change</span> <span class="o">=</span> <span class="bp">False</span>
+        
+<div class="viewcode-block" id="FitPage.qrang_set_focus"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.qrang_set_focus">[docs]</a>    <span class="k">def</span> <span class="nf">qrang_set_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        ON Qrange focus</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="c">#tcrtl = event.GetEventObject()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="FitPage.qrange_click"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.qrange_click">[docs]</a>    <span class="k">def</span> <span class="nf">qrange_click</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Qrange textctrl click, make the qrange lines in the plot</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">is_click</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">LeftDown</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">is_click</span><span class="p">:</span>
+            <span class="n">d_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span>
+            <span class="n">d_group_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+            <span class="n">act_ctrl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                         <span class="n">PlotQrangeEvent</span><span class="p">(</span><span class="n">ctrl</span><span class="o">=</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">],</span> <span class="nb">id</span><span class="o">=</span><span class="n">d_id</span><span class="p">,</span> 
+                                     <span class="n">group_id</span><span class="o">=</span><span class="n">d_group_id</span><span class="p">,</span> <span class="n">leftdown</span><span class="o">=</span><span class="n">is_click</span><span class="p">,</span>
+                                     <span class="n">active</span><span class="o">=</span><span class="n">act_ctrl</span><span class="p">))</span>
+            </div>
+<div class="viewcode-block" id="FitPage.on_qrange_text"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.on_qrange_text">[docs]</a>    <span class="k">def</span> <span class="nf">on_qrange_text</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        #On q range value updated. DO not combine with qrange_click().</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">act_ctrl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">d_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span>
+        <span class="n">d_group_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                     <span class="n">PlotQrangeEvent</span><span class="p">(</span><span class="n">ctrl</span><span class="o">=</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">],</span> <span class="nb">id</span><span class="o">=</span><span class="n">d_id</span><span class="p">,</span> 
+                                     <span class="n">group_id</span><span class="o">=</span><span class="n">d_group_id</span><span class="p">,</span> <span class="n">leftdown</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> 
+                                     <span class="n">active</span><span class="o">=</span><span class="n">act_ctrl</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="FitPage.on_key"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.on_key">[docs]</a>    <span class="k">def</span> <span class="nf">on_key</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>   
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Key down</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">ctrl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">x_data</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">ctrl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="n">key</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetKeyCode</span><span class="p">()</span>
+        <span class="n">length</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+        <span class="n">indx</span> <span class="o">=</span> <span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span> <span class="o">-</span> <span class="n">x_data</span><span class="p">))</span><span class="o">.</span><span class="n">argmin</span><span class="p">()</span>
+        <span class="c">#return array.flat[idx]</span>
+        <span class="k">if</span> <span class="n">key</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">WXK_PAGEUP</span> <span class="ow">or</span> <span class="n">key</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">WXK_NUMPAD_PAGEUP</span><span class="p">:</span>
+            <span class="n">indx</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="k">if</span> <span class="n">indx</span> <span class="o">&gt;=</span> <span class="n">length</span><span class="p">:</span>
+                <span class="n">indx</span> <span class="o">=</span> <span class="n">length</span> <span class="o">-</span> <span class="mi">1</span>
+        <span class="k">elif</span> <span class="n">key</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">WXK_PAGEDOWN</span> <span class="ow">or</span> <span class="n">key</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">WXK_NUMPAD_PAGEDOWN</span><span class="p">:</span>
+            <span class="n">indx</span> <span class="o">-=</span> <span class="mi">1</span>
+            <span class="k">if</span> <span class="n">indx</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">indx</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">ctrl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">[</span><span class="n">indx</span><span class="p">]))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+               </div>
+    <span class="k">def</span> <span class="nf">_onQrangeEnter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check validity of value enter in the Q range field</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">tcrtl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="c">#Clear msg if previously shown.</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="c"># For theory mode</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">create_default_data</span><span class="p">()</span>
+        <span class="c"># Flag to register when a parameter has changed.</span>
+        <span class="k">if</span> <span class="n">tcrtl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                <span class="c"># If qmin and qmax have been modified, update qmin and qmax</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_validate_qrange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">):</span>
+                    <span class="n">tempmin</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="k">if</span> <span class="n">tempmin</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="n">tempmin</span>
+                    <span class="n">tempmax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+                    <span class="k">if</span> <span class="n">tempmax</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="n">tempmax</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error:wrong value entered : </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                    <span class="k">return</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error:wrong value entered : </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                <span class="k">return</span>
+            <span class="c">#Check if # of points for theory model are valid(&gt;0).</span>
+            <span class="c"># check for 2d</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                    <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                <span class="c"># set mask</span>
+                <span class="n">radius</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">+</span>
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qy_data</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qy_data</span><span class="p">)</span>
+                <span class="n">index_data</span> <span class="o">=</span> <span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">&lt;=</span> <span class="n">radius</span><span class="p">)</span> <span class="o">&amp;</span> \
+                                <span class="p">(</span><span class="n">radius</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">))</span>
+                <span class="n">index_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">index_data</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">mask</span><span class="p">)</span>
+                <span class="n">index_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">index_data</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">data</span><span class="p">))</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">index_data</span><span class="p">[</span><span class="n">index_data</span><span class="p">])</span> <span class="o">&lt;</span> <span class="mi">10</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Cannot Plot :No or too little npts in&quot;</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; that data range!!!  &quot;</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                                 <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                    <span class="k">return</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="c">#self.data.mask = index_data</span>
+                    <span class="c">#self.Npts_fit.SetValue(str(len(self.data.mask)))</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">show_npts2fit</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">index_data</span> <span class="o">=</span> <span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span> <span class="o">&amp;</span> \
+                              <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">[</span><span class="n">index_data</span><span class="p">])))</span>
+            
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">create_default_data</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_save_plotting_range</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">tcrtl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error:wrong value entered!!!&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_change</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">return</span>
+    
+    <span class="k">def</span> <span class="nf">_clear_Err_on_Fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        hide the error text control shown</span>
+<span class="sd">        after fitting</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;text2_3&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">text2_3</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                    <span class="c">#Skip t ifhe angle parameters if 1D data</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">and</span> \
+                            <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                        <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                            <span class="k">continue</span>
+                    <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+                        <span class="k">continue</span>
+                    <span class="c">## hide statictext +/-</span>
+                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">item</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">4</span><span class="p">:</span>
+                        <span class="k">continue</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                    <span class="c">## hide textcrtl  for error after fit</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+  
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                    <span class="c">#Skip t ifhe angle parameters if 1D data</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">and</span> \
+                            <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                        <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                            <span class="k">continue</span>
+                    <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+                        <span class="k">continue</span>
+                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">item</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">4</span><span class="p">:</span>
+                        <span class="k">continue</span>
+                    <span class="c">## hide statictext +/-</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                    <span class="c">## hide textcrtl  for error after fit</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="k">return</span>
+                
+    <span class="k">def</span> <span class="nf">_get_defult_custom_smear</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the defult values for custum smearing.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the default values</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dxl</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="mf">0.0</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dxw</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">=</span> <span class="n">SMEAR_SIZE_L</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">=</span> <span class="n">SMEAR_SIZE_H</span>
+        
+    <span class="k">def</span> <span class="nf">_get_smear_info</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the smear info from data.</span>
+<span class="sd">       </span>
+<span class="sd">        :return: self.smear_type, self.dq_l and self.dq_r,</span>
+<span class="sd">            respectively the type of the smear, dq_min and</span>
+<span class="sd">            dq_max for pinhole smear data</span>
+<span class="sd">            while dxl and dxw for slit smear</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># default</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dq_l</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dq_r</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+            <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">dqx_data</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span>  <span class="n">data</span><span class="o">.</span><span class="n">dqy_data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">!=</span> <span class="bp">None</span> \
+                <span class="ow">and</span> <span class="n">data</span><span class="o">.</span><span class="n">dqx_data</span><span class="o">.</span><span class="n">any</span><span class="p">()</span> <span class="o">!=</span> <span class="mi">0</span> \
+                <span class="ow">and</span> <span class="n">data</span><span class="o">.</span><span class="n">dqx_data</span><span class="o">.</span><span class="n">any</span><span class="p">()</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">=</span> <span class="s">&quot;Pinhole2d&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">dq_l</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">average</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">dqx_data</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">dq_r</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">average</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">dqy_data</span><span class="p">))</span>
+                <span class="k">return</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">return</span>
+        <span class="c"># check if it is pinhole smear and get min max if it is.</span>
+        <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">dx</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">all</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">dx</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">=</span> <span class="s">&quot;Pinhole&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dq_l</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">dx</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dq_r</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">dx</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
+            
+        <span class="c"># check if it is slit smear and get min max if it is.</span>
+        <span class="k">elif</span> <span class="n">data</span><span class="o">.</span><span class="n">dxl</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">data</span><span class="o">.</span><span class="n">dxw</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">=</span> <span class="s">&quot;Slit&quot;</span>
+            <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">dxl</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">all</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">dxl</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">):</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">dq_l</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">dxl</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">dxw</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">all</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">dxw</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">):</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">dq_r</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">dxw</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="c">#return self.smear_type,self.dq_l,self.dq_r</span>
+    
+    <span class="k">def</span> <span class="nf">_show_smear_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show only the sizers depending on smear selection</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># smear disabled</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_none</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="c"># 2Dsmear</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_accuracy_type</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_accuracy</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_accuracy_type</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d_x</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d_y</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_min</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_max</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="c"># smear from data</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_dqdata</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_smear_type</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">==</span> <span class="s">&#39;Slit&#39;</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_slit_height</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_slit_width</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">==</span> <span class="s">&#39;Pinhole&#39;</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_pin_min</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_pin_max</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_smear_type</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_type</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_left</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_right</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="c"># custom pinhole smear</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">==</span> <span class="s">&#39;Pinhole&#39;</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_message_new_p</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_pin_min</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_pin_max</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_min</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_max</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="c"># custom slit smear</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_message_new_s</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_slit_height</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_slit_width</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">_hide_all_smear_info</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Hide all smearing messages in the set_smearer sizer</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_none</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_dqdata</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_type</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_smear_type</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_accuracy_type</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d_x</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d_y</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_2d</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_accuracy</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_left</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_right</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_pin_min</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_min</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_pin_max</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_max</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_slit_height</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_slit_width</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_message_new_p</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_message_new_s</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+    
+    <span class="k">def</span> <span class="nf">_set_accuracy_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the list of an accuracy in 2D custum smear:</span>
+<span class="sd">                Xhigh, High, Med, or Low</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># list of accuracy choices</span>
+        <span class="nb">list</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;Low&#39;</span><span class="p">,</span> <span class="s">&#39;Med&#39;</span><span class="p">,</span> <span class="s">&#39;High&#39;</span><span class="p">,</span> <span class="s">&#39;Xhigh&#39;</span><span class="p">]</span>
+        <span class="k">for</span> <span class="n">idx</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">)):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_accuracy</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="n">idx</span><span class="p">],</span> <span class="n">idx</span><span class="p">)</span>
+            
+    <span class="k">def</span> <span class="nf">_set_fun_box_list</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fun_box</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the list of func for multifunctional models</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Check if it is multi_functional model</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">__class__</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">[</span><span class="s">&quot;Multi-Functions&quot;</span><span class="p">]</span> \
+                <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">temp_multi_functional</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="c"># Get the func name list</span>
+        <span class="nb">list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="c"># build function (combo)box</span>
+        <span class="n">ind</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">while</span><span class="p">(</span><span class="n">ind</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">)):</span>
+            <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">val</span> <span class="ow">in</span> <span class="nb">list</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="k">if</span> <span class="p">(</span><span class="n">val</span> <span class="o">==</span> <span class="n">ind</span><span class="p">):</span>
+                    <span class="n">fun_box</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span>
+                    <span class="k">break</span>
+            <span class="n">ind</span> <span class="o">+=</span> <span class="mi">1</span>
+        
+    <span class="k">def</span> <span class="nf">_on_select_accuracy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Select an accuracy in 2D custom smear: Xhigh, High, Med, or Low</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#event.Skip()</span>
+        <span class="c"># Check if the accuracy is same as before</span>
+        <span class="c">#self.smear2d_accuracy = event.GetEventObject().GetValue()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear2d_accuracy</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_accuracy</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">onPinholeSmear</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">onSmear</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span><span class="o">.</span><span class="n">set_accuracy</span><span class="p">(</span><span class="n">accuracy</span><span class="o">=</span>\
+                                                  <span class="bp">self</span><span class="o">.</span><span class="n">smear2d_accuracy</span><span class="p">)</span> 
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+
+    <span class="k">def</span> <span class="nf">_on_fun_box</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Select an func: Erf,Rparabola,LParabola</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">fun_val</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">fun_box</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="n">fun_box</span><span class="o">.</span><span class="n">Name</span>
+        <span class="n">value</span> <span class="o">=</span> <span class="n">fun_box</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span><span class="p">:</span>
+            <span class="n">fun_val</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span><span class="p">[</span><span class="n">value</span><span class="p">]</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">fun_val</span><span class="p">)</span>
+        <span class="c"># save state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_copy_parameters_state</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">,</span>
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">)</span>
+        <span class="c"># update params</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_update_paramv_on_fit</span><span class="p">()</span>
+        <span class="c"># draw</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="c"># get ready for new event</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_onMask</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Build a panel to allow to edit Mask</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">sas.guiframe.local_perspectives.plotting.masking</span> \
+        <span class="kn">import</span> <span class="n">MaskPanel</span> <span class="k">as</span> <span class="n">MaskDialog</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">MaskDialog</span><span class="p">(</span><span class="n">base</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_draw_masked_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw model image w/mask</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">is_valid_qrange</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_update_paramv_on_fit</span><span class="p">()</span>
+
+        <span class="k">if</span> <span class="n">is_valid_qrange</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">MakeModal</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            <span class="c"># try re draw the model plot if it exists</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">show_npts2fit</span><span class="p">()</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">MakeModal</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">show_npts2fit</span><span class="p">()</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;No model is found on updating MASK in the model plot... &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39; Please consider your Q range, too.&#39;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">ShowMessage</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">_set_smear</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set_smear</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">=</span> <span class="n">smear_selection</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">flag</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">onSmear</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">_mac_sleep</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sec</span><span class="o">=</span><span class="mf">0.2</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Give sleep to MAC</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+            <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="n">sec</span><span class="p">)</span>
+
+<div class="viewcode-block" id="FitPage.get_view_mode"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.get_view_mode">[docs]</a>    <span class="k">def</span> <span class="nf">get_view_mode</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return True if the panel allow 2D or False if 1D</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span>
+    </div>
+<div class="viewcode-block" id="FitPage.compute_data_set_range"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.compute_data_set_range">[docs]</a>    <span class="k">def</span> <span class="nf">compute_data_set_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        find the range that include all data  in the set</span>
+<span class="sd">        return the minimum and the maximum values</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">data_list</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">data_list</span> <span class="o">!=</span> <span class="p">[]:</span>
+            <span class="k">for</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">data_list</span><span class="p">:</span>
+                <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="p">,</span> <span class="n">npts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">compute_data_range</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmin_data_set</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_data_set</span><span class="p">,</span> <span class="n">qmin</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmax_data_set</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_data_set</span><span class="p">,</span> <span class="n">qmax</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">npts_data_set</span> <span class="o">+=</span> <span class="n">npts</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_data_set</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_data_set</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">npts_data_set</span>
+        </div>
+<div class="viewcode-block" id="FitPage.compute_data_range"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.compute_data_range">[docs]</a>    <span class="k">def</span> <span class="nf">compute_data_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        compute the minimum and the maximum range of the data</span>
+<span class="sd">        return the npts contains in data</span>
+<span class="sd">        :param data:</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="p">,</span> <span class="n">npts</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s">&quot;data&quot;</span><span class="p">):</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">qmin</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+                    <span class="c"># Maximum value of data</span>
+                    <span class="n">qmax</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+                    <span class="n">npts</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Unable to find min/max/length of </span><span class="se">\n</span><span class="s"> data named </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> \
+                                <span class="n">data</span><span class="o">.</span><span class="n">filename</span>  
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                               <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+                    <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">msg</span>
+                    
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">qmin</span> <span class="o">=</span> <span class="mi">0</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">x</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">xmin</span><span class="p">),</span> <span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">xmax</span><span class="p">))</span>
+                    <span class="n">y</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">ymin</span><span class="p">),</span> <span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">ymax</span><span class="p">))</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Unable to find min/max of </span><span class="se">\n</span><span class="s"> data named </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> \
+                                <span class="n">data</span><span class="o">.</span><span class="n">filename</span>  
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                               <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+                    <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">msg</span>
+                <span class="c">## Maximum value of data</span>
+                <span class="n">qmax</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">x</span> <span class="o">*</span> <span class="n">x</span> <span class="o">+</span> <span class="n">y</span> <span class="o">*</span> <span class="n">y</span><span class="p">)</span>
+                <span class="n">npts</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="p">,</span> <span class="n">npts</span>
+            </div>
+<div class="viewcode-block" id="FitPage.set_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.set_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        reset the current data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">old_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span>
+            <span class="n">old_group_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">old_id</span> <span class="o">=</span> <span class="nb">id</span>
+            <span class="n">old_group_id</span> <span class="o">=</span> <span class="nb">id</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">is_data</span> <span class="o">=</span> <span class="n">check_data_validity</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">is_data</span> <span class="ow">and</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="nb">id</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">id</span>
+            <span class="k">if</span> <span class="n">is_data</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+                <span class="n">flag</span> <span class="o">=</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="k">if</span> <span class="n">check_data_validity</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span>
+        
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data_name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_keep</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_keep</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>    
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_smear</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            <span class="c"># more disables for 2D</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                        <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">default_mask</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="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">mask</span><span class="p">)</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">err_data</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span>\
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">err_data</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">all</span><span class="p">()</span> <span class="ow">or</span>\
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">err_data</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span><span class="o">.</span><span class="n">all</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">weightbt_string</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">GetLabelText</span><span class="p">()</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">weightbt_string</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">GetLabelText</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">dy</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span>\
+                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">dy</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">all</span><span class="p">()</span> <span class="ow">or</span>\
+                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">dy</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span><span class="o">.</span><span class="n">all</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">weightbt_string</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">GetLabelText</span><span class="p">()</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">weightbt_string</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="o">.</span><span class="n">GetLabelText</span><span class="p">()</span>
+            <span class="c"># Enable weighting radio uttons</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+              
+            <span class="bp">self</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">structurebox</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="n">data_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span>
+            <span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">npts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">compute_data_range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+            <span class="c">#set maximum range for x in linear scale</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="s">&quot;data&quot;</span><span class="p">):</span>  <span class="c"># Display only for 1D data fit</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+    
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">npts</span><span class="p">))</span>
+        <span class="c">#default:number of data points selected to fit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">npts</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span>\
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">GetParent</span><span class="p">()</span><span class="o">.</span><span class="n">GetBackgroundColour</span><span class="p">())</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_total</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_MOUSE_EVENTS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_npts_click</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pointsbox</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dataSource</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">data_name</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_fit_button</span><span class="p">()</span>
+        <span class="c"># send graph_id to page_finder</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_graph_id</span><span class="p">(</span><span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span> <span class="n">graph_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span><span class="p">)</span>
+        <span class="c">#focus the page</span>
+        <span class="k">if</span> <span class="n">check_data_validity</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_box_description</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">BLUE</span><span class="p">)</span>
+        
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">btEditMask</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">EditMask_title</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_set_focus</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="c">#update model plot with new data information</span>
+        <span class="k">if</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="c">#set model view button</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">onSmear</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;2D Mode&quot;</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;1D Mode&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="c">#replace data plot on combo box selection</span>
+            <span class="c">#by removing the previous selected data</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                             <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">action</span><span class="o">=</span><span class="s">&quot;delete&quot;</span><span class="p">,</span>
+                                          <span class="n">group_id</span><span class="o">=</span><span class="n">old_group_id</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">old_id</span><span class="p">))</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+            <span class="c">#plot the current selected data</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">action</span><span class="o">=</span><span class="s">&quot;check&quot;</span><span class="p">,</span> <span class="n">plot</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span>
+                                      <span class="n">title</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">title</span><span class="p">)))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_npts_click</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Prevent further handling of the mouse event on Npts_total</span>
+<span class="sd">        by not calling Skip().</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">pass</span>
+    
+<div class="viewcode-block" id="FitPage.reset_page"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.reset_page">[docs]</a>    <span class="k">def</span> <span class="nf">reset_page</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="p">,</span> <span class="n">first</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        reset the state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">reset_page_helper</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+    
+            <span class="bp">self</span><span class="o">.</span><span class="n">select_param</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+            <span class="c">#Save state_fit</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state_fit</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_show_combox_helper</span><span class="p">()</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error: This model state has missing or outdated &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;information.</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_lay_out</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="FitPage.get_range"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.get_range">[docs]</a>    <span class="k">def</span> <span class="nf">get_range</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the fitting range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">),</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="FitPage.get_npts2fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.get_npts2fit">[docs]</a>    <span class="k">def</span> <span class="nf">get_npts2fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return numbers of data points within qrange</span>
+<span class="sd">        </span>
+<span class="sd">        :Note: This is for Park where chi2 is not normalized by Npts of fit</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">npts2fit</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_range</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                        <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+            <span class="n">radius</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">+</span>
+                                <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qy_data</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qy_data</span><span class="p">)</span>
+            <span class="n">index_data</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">&lt;=</span> <span class="n">radius</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">radius</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">)</span>
+            <span class="n">index_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">index_data</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">mask</span><span class="p">)</span>
+            <span class="n">index_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">index_data</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">data</span><span class="p">))</span>
+            <span class="n">npts2fit</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="n">index_data</span><span class="p">])</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">qx</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">qx</span> <span class="o">&gt;=</span> <span class="n">qmin</span> <span class="ow">and</span> <span class="n">qx</span> <span class="o">&lt;=</span> <span class="n">qmax</span><span class="p">:</span>
+                    <span class="n">npts2fit</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="k">return</span> <span class="n">npts2fit</span>
+</div>
+<div class="viewcode-block" id="FitPage.show_npts2fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.show_npts2fit">[docs]</a>    <span class="k">def</span> <span class="nf">show_npts2fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        setValue Npts for fitting</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Npts_fit</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_npts2fit</span><span class="p">()))</span>
+        </div>
+<div class="viewcode-block" id="FitPage.get_chi2"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.get_chi2">[docs]</a>    <span class="k">def</span> <span class="nf">get_chi2</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the current chi2</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="FitPage.onsetValues"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.onsetValues">[docs]</a>    <span class="k">def</span> <span class="nf">onsetValues</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">chisqr</span><span class="p">,</span> <span class="n">p_name</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="n">cov</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Build the panel from the fit result</span>
+<span class="sd">        </span>
+<span class="sd">        :param chisqr: Value of the goodness of fit metric</span>
+<span class="sd">        :param p_name: the name of parameters</span>
+<span class="sd">        :param out: list of parameter with the best value found during fitting</span>
+<span class="sd">        :param cov: Covariance matrix</span>
+<span class="sd">   </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># make sure stop button to fit button all the time</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_fit_complete</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">out</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">chisqr</span><span class="p">):</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;Fit error occured...&quot;</span>
+        
+        <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">has_error</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">dispersity</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        
+        <span class="c">#Hide textctrl boxes of errors.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_clear_Err_on_Fit</span><span class="p">()</span>
+        
+        <span class="c">#Check if chi2 is finite</span>
+        <span class="k">if</span> <span class="n">chisqr</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">chisqr</span><span class="p">):</span>
+            <span class="c">#format chi2</span>
+            <span class="n">chi2</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="n">chisqr</span><span class="p">,</span> <span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">chi2</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;-&quot;</span><span class="p">)</span>
+        
+        <span class="c">#Hide error title</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">text2_3</span><span class="o">.</span><span class="n">IsShown</span><span class="p">()</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">text2_3</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+      
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;text_disp_1&quot;</span><span class="p">):</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_disp_1</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">text_disp_1</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">dispersity</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">pass</span>
+      
+        <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">#Set the panel when fit result are list</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">item</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">5</span> <span class="ow">and</span> <span class="n">item</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                    <span class="c">## reset error value to initial state</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                    <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">out</span><span class="p">)):</span>
+                        <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="n">p_name</span><span class="p">[</span><span class="n">ind</span><span class="p">]:</span>
+                            <span class="k">break</span>
+                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">out</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">out</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="n">val_out</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="n">out</span><span class="p">[</span><span class="n">ind</span><span class="p">],</span> <span class="bp">True</span><span class="p">)</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val_out</span><span class="p">)</span>
+    
+                    <span class="k">if</span><span class="p">(</span><span class="n">cov</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">cov</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">out</span><span class="p">)):</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="k">if</span> <span class="n">dispersity</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                                    <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;text_disp_1&quot;</span><span class="p">):</span>
+                                        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_disp_1</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                                            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_disp_1</span><span class="o">.</span><span class="n">IsShown</span><span class="p">()</span>\
+                                                <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+                                                <span class="bp">self</span><span class="o">.</span><span class="n">text_disp_1</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="k">pass</span>
+                        
+                        <span class="k">if</span> <span class="n">cov</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                            <span class="k">if</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">cov</span><span class="p">[</span><span class="n">ind</span><span class="p">])):</span>
+                                <span class="n">val_err</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="n">cov</span><span class="p">[</span><span class="n">ind</span><span class="p">],</span> <span class="bp">True</span><span class="p">)</span>
+                                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+                                    <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                                    <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                                <span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">val_err</span><span class="p">)</span>
+                                <span class="n">has_error</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;onsetValues: Invalid parameters...&quot;</span>
+        <span class="c">#Show error title when any errors displayed</span>
+        <span class="k">if</span> <span class="n">has_error</span><span class="p">:</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">text2_3</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">text2_3</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="c">## save current state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_mac_sleep</span><span class="p">(</span><span class="mf">0.1</span><span class="p">)</span>
+        <span class="c">#plot model ( when drawing, do not update chisqr value again)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">(</span><span class="n">update_chisqr</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="s">&#39;fit&#39;</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="FitPage.onWeighting"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.onWeighting">[docs]</a>    <span class="k">def</span> <span class="nf">onWeighting</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On Weighting radio button event, sets the weightbt_string</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weightbt_string</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span><span class="o">.</span><span class="n">GetLabelText</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_weight</span><span class="p">()</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_set_weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">is_2D</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set weight in fit problem</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># compute weight for the current data</span>
+        <span class="kn">from</span> <span class="nn">sas.perspectives.fitting.utils</span> <span class="kn">import</span> <span class="n">get_weight</span>
+        <span class="n">flag_weight</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_weight_flag</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">is_2D</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">is_2D</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">()</span>
+        <span class="n">weight</span> <span class="o">=</span> <span class="n">get_weight</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span>
+                            <span class="n">is2d</span><span class="o">=</span><span class="n">is_2D</span><span class="p">,</span>
+                            <span class="n">flag</span><span class="o">=</span><span class="n">flag_weight</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_fit_weight</span><span class="p">(</span><span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span>
+                                     <span class="n">flag</span><span class="o">=</span><span class="n">flag_weight</span><span class="p">,</span>
+                                     <span class="n">is2d</span><span class="o">=</span><span class="n">is_2D</span><span class="p">,</span>
+                                     <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="FitPage.onPinholeSmear"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.onPinholeSmear">[docs]</a>    <span class="k">def</span> <span class="nf">onPinholeSmear</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create a custom pinhole smear object that will change the way residuals</span>
+<span class="sd">        are compute when fitting</span>
+<span class="sd">        </span>
+<span class="sd">        :Note: accuracy is given by strings&#39;High&#39;,&#39;Med&#39;, &#39;Low&#39; FOR 2d,</span>
+<span class="sd">                     None for 1D</span>
+<span class="sd">                     </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">event</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please select a Model first...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Smear: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">msg</span><span class="p">))</span>
+            <span class="k">return</span>
+
+        <span class="c"># Need update param values</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_update_paramv_on_fit</span><span class="p">()</span>
+
+        <span class="c"># msg default</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">tcrtl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+            <span class="c"># event case of radio button</span>
+            <span class="k">if</span> <span class="n">tcrtl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">=</span> <span class="mf">0.0</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">=</span> <span class="mf">0.0</span>
+                <span class="n">is_new_pinhole</span> <span class="o">=</span> <span class="bp">True</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">is_new_pinhole</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_changed_pinhole</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">is_new_pinhole</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c"># if any value is changed</span>
+        <span class="k">if</span> <span class="n">is_new_pinhole</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_pinhole_smear</span><span class="p">()</span>
+        <span class="c"># hide all silt sizer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_hide_all_smear_info</span><span class="p">()</span>
+        
+        <span class="c"># show relevant slit sizers</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_show_smear_sizer</span><span class="p">()</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="c">#self._undo.Enable(True)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_is_changed_pinhole</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        check if any of pinhole smear is changed</span>
+<span class="sd">        </span>
+<span class="sd">        :return: True or False</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the values</span>
+        <span class="n">pin_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_min</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="n">pin_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_max</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+                    
+        <span class="c"># Check changes in slit width</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">dx_min</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">pin_min</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">!=</span> <span class="n">dx_min</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">True</span>
+        
+        <span class="c"># Check changes in slit heigth</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">dx_max</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">pin_max</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">!=</span> <span class="n">dx_max</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">True</span>
+        <span class="k">return</span> <span class="bp">False</span>
+    
+    <span class="k">def</span> <span class="nf">_set_pinhole_smear</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set custom pinhole smear</span>
+<span class="sd">        </span>
+<span class="sd">        :return: msg</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># copy data</span>
+        <span class="n">data</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="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">=</span> <span class="s">&#39;Pinhole2d&#39;</span>
+            <span class="n">len_data</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">dqx_data</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">len_data</span><span class="p">)</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">dqy_data</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">len_data</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">=</span> <span class="s">&#39;Pinhole&#39;</span>
+            <span class="n">len_data</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">dx</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">len_data</span><span class="p">)</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="bp">None</span>
+   
+        <span class="n">get_pin_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_min</span>
+        <span class="n">get_pin_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_pinhole_max</span>
+
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">check_float</span><span class="p">(</span><span class="n">get_pin_min</span><span class="p">):</span>
+            <span class="n">get_pin_min</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error:wrong value entered!!!&quot;</span>
+        <span class="k">elif</span> <span class="ow">not</span> <span class="n">check_float</span><span class="p">(</span><span class="n">get_pin_max</span><span class="p">):</span>
+            <span class="n">get_pin_max</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error:wrong value entered!!!&quot;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">len_data</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">:</span>
+                <span class="n">len_data</span> <span class="o">=</span> <span class="mi">2</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">get_pin_min</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">get_pin_max</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">get_pin_min</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error:This value can not be negative!!!&quot;</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">get_pin_max</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Model Error:This value can not be negative!!!&quot;</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+                    <span class="n">data</span><span class="o">.</span><span class="n">dqx_data</span><span class="p">[</span><span class="n">data</span><span class="o">.</span><span class="n">dqx_data</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span>
+                    <span class="n">data</span><span class="o">.</span><span class="n">dqy_data</span><span class="p">[</span><span class="n">data</span><span class="o">.</span><span class="n">dqy_data</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span>
+                <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span><span class="p">:</span>
+                    <span class="n">data</span><span class="o">.</span><span class="n">dx</span><span class="p">[</span><span class="n">data</span><span class="o">.</span><span class="n">dx</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">step</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">len_data</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span>
+                    <span class="n">data</span><span class="o">.</span><span class="n">dx</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span><span class="p">,</span>
+                                           <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">+</span> <span class="n">step</span> <span class="o">/</span> <span class="mf">1.1</span><span class="p">,</span>
+                                           <span class="n">step</span><span class="p">)</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+                    <span class="n">data</span><span class="o">.</span><span class="n">dqx_data</span><span class="p">[</span><span class="n">data</span><span class="o">.</span><span class="n">dqx_data</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">data</span><span class="o">.</span><span class="n">dx</span><span class="p">[</span><span class="n">data</span><span class="o">.</span><span class="n">dx</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+                    <span class="n">data</span><span class="o">.</span><span class="n">dqy_data</span><span class="p">[</span><span class="n">data</span><span class="o">.</span><span class="n">dqy_data</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">data</span><span class="o">.</span><span class="n">dx</span><span class="p">[</span><span class="n">data</span><span class="o">.</span><span class="n">dx</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">=</span> <span class="n">smear_selection</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+            <span class="c"># 2D need to set accuracy</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span><span class="o">.</span><span class="n">set_accuracy</span><span class="p">(</span><span class="n">accuracy</span><span class="o">=</span>\
+                                                  <span class="bp">self</span><span class="o">.</span><span class="n">smear2d_accuracy</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="n">msg</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">get_pin_min</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+            <span class="n">get_pin_max</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;white&quot;</span><span class="p">)</span>
+        <span class="c">## set smearing value whether or not the data contain the smearing info</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_smearer</span><span class="p">(</span><span class="n">smearer</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span><span class="p">,</span>
+                            <span class="n">fid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
+                            <span class="n">qmin</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">),</span>
+                            <span class="n">qmax</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">),</span>
+                            <span class="n">enable_smearer</span><span class="o">=</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">(),</span>
+                            <span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">msg</span>
+        
+<div class="viewcode-block" id="FitPage.update_pinhole_smear"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.update_pinhole_smear">[docs]</a>    <span class="k">def</span> <span class="nf">update_pinhole_smear</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        called by kill_focus on pinhole TextCntrl</span>
+<span class="sd">        to update the changes</span>
+<span class="sd">        </span>
+<span class="sd">        :return: False when wrong value was entered</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># msg default</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># check if any value is changed</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_changed_pinhole</span><span class="p">():</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_pinhole_smear</span><span class="p">()</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="n">msg</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">False</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">True</span>
+                     </div>
+<div class="viewcode-block" id="FitPage.onSlitSmear"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.onSlitSmear">[docs]</a>    <span class="k">def</span> <span class="nf">onSlitSmear</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create a custom slit smear object that will change the way residuals</span>
+<span class="sd">        are compute when fitting</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">event</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please select a Model first...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Smear: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">msg</span><span class="p">))</span>
+            <span class="k">return</span>
+
+        <span class="c"># Need update param values</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_update_paramv_on_fit</span><span class="p">()</span>
+
+        <span class="c"># msg default</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># for event given</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">tcrtl</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+            <span class="c"># event case of radio button</span>
+            <span class="k">if</span> <span class="n">tcrtl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="mf">0.0</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="mf">0.0</span>
+                <span class="n">is_new_slit</span> <span class="o">=</span> <span class="bp">True</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">is_new_slit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_changed_slit</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">is_new_slit</span> <span class="o">=</span> <span class="bp">True</span>
+        
+        <span class="c"># if any value is changed</span>
+        <span class="k">if</span> <span class="n">is_new_slit</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_slit_smear</span><span class="p">()</span>
+            
+        <span class="c"># hide all silt sizer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_hide_all_smear_info</span><span class="p">()</span>
+        <span class="c"># show relevant slit sizers</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_show_smear_sizer</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+        <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">msg</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+</div>
+    <span class="k">def</span> <span class="nf">_is_changed_slit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        check if any of slit lengths is changed</span>
+<span class="sd">        </span>
+<span class="sd">        :return: True or False</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># get the values</span>
+        <span class="n">width</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="n">height</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        
+        <span class="c"># check and change the box bg color if it was pink</span>
+        <span class="c">#    but it should be white now</span>
+        <span class="c"># because this is the case that _set_slit_smear() will not handle</span>
+        <span class="k">if</span> <span class="n">height</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">width</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+            
+        <span class="c"># Check changes in slit width</span>
+        <span class="k">if</span> <span class="n">width</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="n">dxw</span> <span class="o">=</span> <span class="mf">0.0</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">dxw</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">width</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dxw</span> <span class="o">!=</span> <span class="n">dxw</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">True</span>
+        
+        <span class="c"># Check changes in slit heigth</span>
+        <span class="k">if</span> <span class="n">height</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="n">dxl</span> <span class="o">=</span> <span class="mf">0.0</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">dxl</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">height</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dxl</span> <span class="o">!=</span> <span class="n">dxl</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">True</span>
+
+        <span class="k">return</span> <span class="bp">False</span>
+    
+    <span class="k">def</span> <span class="nf">_set_slit_smear</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set custom slit smear</span>
+<span class="sd">        </span>
+<span class="sd">        :return: message to inform the user about the validity</span>
+<span class="sd">            of the values entered for slit smear</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                        <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c"># make sure once more if it is smearer</span>
+        <span class="n">data</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="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        <span class="n">data_len</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+        <span class="n">data</span><span class="o">.</span><span class="n">dx</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">data</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">data</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="bp">None</span>
+   
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dxl</span> <span class="o">*</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="n">data_len</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">data_len</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Wrong value entered... &quot;</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_height</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">dxw</span> <span class="o">*</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="n">data_len</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">data_len</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Wrong Fit value entered... &quot;</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">smear_slit_width</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+              
+        <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">=</span> <span class="n">smear_selection</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+        <span class="c">## set smearing value whether or not the data contain the smearing info</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_smearer</span><span class="p">(</span><span class="n">smearer</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span><span class="p">,</span>
+                                 <span class="n">fid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
+                                 <span class="n">qmin</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">),</span>
+                                 <span class="n">qmax</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">),</span>
+                        <span class="n">enable_smearer</span><span class="o">=</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">(),</span>
+                                 <span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">msg</span>
+    
+<div class="viewcode-block" id="FitPage.update_slit_smear"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.update_slit_smear">[docs]</a>    <span class="k">def</span> <span class="nf">update_slit_smear</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        called by kill_focus on pinhole TextCntrl</span>
+<span class="sd">        to update the changes</span>
+<span class="sd">        </span>
+<span class="sd">        :return: False when wrong value was entered</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># msg default</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># check if any value is changed</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_changed_slit</span><span class="p">():</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_slit_smear</span><span class="p">()</span>
+        <span class="c">#self._undo.Enable(True)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+
+        <span class="k">if</span> <span class="n">msg</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">False</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">True</span>
+                            </div>
+<div class="viewcode-block" id="FitPage.onSmear"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.onSmear">[docs]</a>    <span class="k">def</span> <span class="nf">onSmear</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create a smear object that will change the way residuals</span>
+<span class="sd">        are compute when fitting</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">event</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please select a Model first...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Smear: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">msg</span><span class="p">))</span>
+            <span class="k">return</span>
+        <span class="c"># Need update param values</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_update_paramv_on_fit</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        <span class="n">temp_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_smear_helper</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_set_smearer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_weight</span><span class="p">()</span>
+        
+        <span class="c">## set smearing value whether or not the data contain the smearing info</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_smearer</span><span class="p">,</span> <span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span>
+                     <span class="n">smearer</span><span class="o">=</span><span class="n">temp_smearer</span><span class="p">,</span>
+                     <span class="n">fid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
+                     <span class="n">qmin</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span><span class="p">),</span>
+                     <span class="n">qmax</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span><span class="p">),</span>
+                     <span class="n">enable_smearer</span><span class="o">=</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">(),</span>
+                     <span class="n">draw</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">disable_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">pinhole_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">slit_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="FitPage.on_smear_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.on_smear_helper">[docs]</a>    <span class="k">def</span> <span class="nf">on_smear_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Help for onSmear</span>
+<span class="sd">        </span>
+<span class="sd">        :param update: force or not to update</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_get_smear_info</span><span class="p">()</span>
+        <span class="c">#renew smear sizer</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_smear_type</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_left</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dq_l</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_right</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dq_r</span><span class="p">))</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">_hide_all_smear_info</span><span class="p">()</span>
+        <span class="n">data</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="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        
+        <span class="c"># make sure once more if it is smearer</span>
+        <span class="n">temp_smearer</span> <span class="o">=</span> <span class="n">smear_selection</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">!=</span> <span class="n">temp_smearer</span> <span class="ow">or</span> <span class="n">update</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">=</span> <span class="n">temp_smearer</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                    <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Data contains no smearing information&quot;</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                    <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Data contains smearing information&quot;</span><span class="p">))</span>
+
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_left</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_data_right</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">temp_smearer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_smearer</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smear_description_none</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">onPinholeSmear</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">onSlitSmear</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_show_smear_sizer</span><span class="p">()</span>
+        
+        <span class="k">return</span> <span class="n">temp_smearer</span>
+    </div>
+<div class="viewcode-block" id="FitPage.on_complete_chisqr"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.on_complete_chisqr">[docs]</a>    <span class="k">def</span> <span class="nf">on_complete_chisqr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Display result chisqr on the panel</span>
+<span class="sd">        :event: activated by fitting/ complete after draw</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">event</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">output</span> <span class="o">=</span> <span class="s">&quot;-&quot;</span>
+            <span class="k">elif</span> <span class="ow">not</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">output</span><span class="p">):</span>
+                <span class="n">output</span> <span class="o">=</span> <span class="s">&quot;-&quot;</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">output</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">output</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">output</span><span class="p">,</span> <span class="bp">True</span><span class="p">)))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">tcChi</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+            </div>
+<div class="viewcode-block" id="FitPage.get_all_checked_params"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.get_all_checked_params">[docs]</a>    <span class="k">def</span> <span class="nf">get_all_checked_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Found all parameters current check and add them to list of parameters</span>
+<span class="sd">        to fit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="ow">and</span> <span class="n">item</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="ow">and</span> <span class="n">item</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state_fit</span><span class="p">()</span>
+       
+        <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        <span class="n">param2fit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                <span class="n">param2fit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_param2fit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span> <span class="n">param2fit</span><span class="p">)</span>
+                </div>
+<div class="viewcode-block" id="FitPage.select_all_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.select_all_param">[docs]</a>    <span class="k">def</span> <span class="nf">select_all_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set to true or false all checkBox given the main checkbox value cb1</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">if</span>  <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span> <span class="o">!=</span> <span class="p">[]:</span>
+            <span class="k">if</span>  <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                        <span class="c">## for data2D select all to fit</span>
+                        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                                <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                            <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="c">## for 1D all parameters except orientation</span>
+                            <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                                <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                                <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="c">#if len(self.fittable_param)&gt;0:</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                                <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                            <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                            <span class="k">try</span><span class="p">:</span>
+                                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">[</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]])</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                                    <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                            <span class="k">except</span><span class="p">:</span>
+                                <span class="k">pass</span>
+    
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="c">## for 1D all parameters except orientation</span>
+                            <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">:</span>
+                                <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                                <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                                <span class="k">try</span><span class="p">:</span>
+                                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">[</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]])</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                                        <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                                <span class="k">except</span><span class="p">:</span>
+                                    <span class="k">pass</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+                    <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">:</span>
+                    <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+           
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state_fit</span><span class="p">()</span>
+       
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c">#self._undo.Enable(True)</span>
+            <span class="c">## post state to fit panel</span>
+            <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        <span class="n">param2fit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                <span class="n">param2fit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_param2fit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span> <span class="n">param2fit</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="FitPage.select_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.select_param">[docs]</a>    <span class="k">def</span> <span class="nf">select_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Select TextCtrl  checked for fitting purpose and stores them</span>
+<span class="sd">        in  self.param_toFit=[] list</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+            <span class="c">#Skip t ifhe angle parameters if 1D data</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">and</span>\
+                        <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                    <span class="k">continue</span>
+            <span class="c">#Select parameters to fit for list of primary parameters</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="p">(</span><span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="c">#remove parameters from the fitting list</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+
+        <span class="c">#Select parameters to fit for list of fittable parameters</span>
+        <span class="c">#        with dispersion</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">:</span>
+            <span class="c">#Skip t ifhe angle parameters if 1D data</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">and</span>\
+                        <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                    <span class="k">continue</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="p">(</span><span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="c">#remove parameters from the fitting list</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+
+        <span class="c">#Calculate num. of angle parameters</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                       <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+            <span class="n">len_orient_para</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">len_orient_para</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">)</span>  <span class="c"># assume even len</span>
+        <span class="c">#Total num. of angle parameters</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">len_orient_para</span> <span class="o">*=</span> <span class="mi">2</span>
+        <span class="c">#Set the value of checkbox that selected every checkbox or not</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">)</span> <span class="o">-</span> <span class="n">len_orient_para</span> \
+            <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state_fit</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c">## post state to fit panel</span>
+            <span class="n">event</span> <span class="o">=</span> <span class="n">PageInfoEvent</span><span class="p">(</span><span class="n">page</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">event</span><span class="p">)</span>
+        
+        <span class="n">param2fit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                <span class="n">param2fit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">set_param2fit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span> <span class="n">param2fit</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="FitPage.set_model_param_sizer"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.set_model_param_sizer">[docs]</a>    <span class="k">def</span> <span class="nf">set_model_param_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Build the panel from the model content</span>
+<span class="sd">        </span>
+<span class="sd">        :param model: the model selected in combo box for fitting purpose</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span> <span class="o">=</span> <span class="p">[]</span>
+        
+        <span class="k">if</span> <span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+            <span class="k">return</span>
+        <span class="c">## the panel is drawn using the current value of the fit engine</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">engine_type</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">engine_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">_return_engine_type</span><span class="p">()</span>
+
+        <span class="n">box_description</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="s">&quot;Model Parameters&quot;</span><span class="p">))</span>
+        <span class="n">boxsizer1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">box_description</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="c">## save the current model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">model</span>
+           
+        <span class="n">keys</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParamList</span><span class="p">()</span>
+        <span class="c">#list of dispersion paramaters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getDispParamList</span><span class="p">()</span>
+
+        <span class="k">def</span> <span class="nf">custom_compare</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
+            <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Custom compare to order, first by alphabets then second by number.</span>
+<span class="sd">            &quot;&quot;&quot;</span>
+            <span class="c"># number at the last digit</span>
+            <span class="n">a_last</span> <span class="o">=</span> <span class="n">a</span><span class="p">[</span><span class="nb">len</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span>
+            <span class="n">b_last</span> <span class="o">=</span> <span class="n">b</span><span class="p">[</span><span class="nb">len</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span>
+            <span class="c"># default</span>
+            <span class="n">num_a</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">num_b</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="c"># split the names</span>
+            <span class="n">a2</span> <span class="o">=</span> <span class="n">a</span><span class="o">.</span><span class="n">lower</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>
+            <span class="n">b2</span> <span class="o">=</span> <span class="n">b</span><span class="o">.</span><span class="n">lower</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>
+            <span class="c"># check length of a2, b2</span>
+            <span class="n">len_a2</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">a2</span><span class="p">)</span>
+            <span class="n">len_b2</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">b2</span><span class="p">)</span>
+            <span class="c"># check if it contains a int number(&lt;10)</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">num_a</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">a_last</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">num_b</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">b_last</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+            <span class="c"># Put &#39;scale&#39; near the top; happens</span>
+            <span class="c"># when numbered param name exists</span>
+            <span class="k">if</span> <span class="n">a</span> <span class="o">==</span> <span class="s">&#39;scale&#39;</span><span class="p">:</span>
+                <span class="k">return</span> <span class="o">-</span><span class="mi">1</span>
+            <span class="c"># both have a number</span>
+            <span class="k">if</span> <span class="n">num_a</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">num_b</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">num_a</span> <span class="o">&gt;</span> <span class="n">num_b</span><span class="p">:</span>
+                    <span class="k">return</span> <span class="o">-</span><span class="mi">1</span>
+                <span class="c"># same number</span>
+                <span class="k">elif</span> <span class="n">num_a</span> <span class="o">==</span> <span class="n">num_b</span><span class="p">:</span>
+                    <span class="c"># different last names</span>
+                    <span class="k">if</span> <span class="n">a2</span><span class="p">[</span><span class="n">len_a2</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="n">b2</span><span class="p">[</span><span class="n">len_b2</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> <span class="ow">and</span> <span class="n">num_a</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="k">return</span> <span class="o">-</span><span class="nb">cmp</span><span class="p">(</span><span class="n">a2</span><span class="p">[</span><span class="n">len_a2</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span> <span class="n">b2</span><span class="p">[</span><span class="n">len_b2</span> <span class="o">-</span> <span class="mi">1</span><span class="p">])</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="k">return</span> <span class="nb">cmp</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="k">return</span> <span class="mi">1</span>
+            <span class="c"># one of them has a number</span>
+            <span class="k">elif</span> <span class="n">num_a</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span> <span class="mi">1</span>
+            <span class="k">elif</span> <span class="n">num_b</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span> <span class="o">-</span><span class="mi">1</span>
+            <span class="c"># no numbers</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">cmp</span><span class="p">(</span><span class="n">a</span><span class="o">.</span><span class="n">lower</span><span class="p">(),</span> <span class="n">b</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
+
+        <span class="n">keys</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">custom_compare</span><span class="p">)</span>
+    
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">select_text</span> <span class="o">=</span> <span class="s">&quot;Select All&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cb1</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">select_text</span><span class="p">),</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</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="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">select_all_param</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;To check/uncheck all the boxes below.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">text2_2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Value&#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">text2_2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">2</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">text2_3</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Error&#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">text2_3</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">text2_3</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">text2_min</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Min&#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">text2_min</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="c">#self.text2_min.Hide()</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">text2_max</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Max&#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">text2_max</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="c">#self.text2_max.Hide()</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">text2_4</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[Units]&#39;</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">text2_4</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">text2_4</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        
+        <span class="n">CHECK_STATE</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> \
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                
+                <span class="c">##prepare a spot to store errors</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>
+         
+                <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+                <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+                <span class="k">if</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">__class__</span> <span class="ow">in</span> \
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">[</span><span class="s">&quot;Multi-Functions&quot;</span><span class="p">]</span> <span class="ow">or</span> \
+                    <span class="bp">self</span><span class="o">.</span><span class="n">temp_multi_functional</span><span class="p">)</span>\
+                    <span class="ow">and</span> <span class="p">(</span><span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">non_fittable</span><span class="p">):</span>
+                    <span class="n">non_fittable_name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">item</span><span class="p">)</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">non_fittable_name</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                            <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">21</span><span class="p">)</span>
+                    <span class="c">## add parameter value</span>
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fun_list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="c">#num = item.split(&#39;_&#39;)[1][5:7]</span>
+                        <span class="n">fun_box</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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> <span class="n">name</span><span class="o">=</span><span class="s">&#39;</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">_set_fun_box_list</span><span class="p">(</span><span class="n">fun_box</span><span class="p">)</span>
+                        <span class="n">fun_box</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+                        <span class="c">#self.fun_box.SetToolTipString(&quot;A function</span>
+                        <span class="c">#    describing the interface&quot;)</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="n">fun_box</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_fun_box</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">fun_box</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                     <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">)</span>
+                        <span class="n">fun_box</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+                                <span class="s">&quot;Hit &#39;Enter&#39; after typing to update the plot.&quot;</span><span class="p">)</span>
+                        <span class="n">fun_box</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="bp">True</span><span class="p">))</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">fun_box</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="bp">None</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">fun_box</span><span class="p">,</span>
+                                                <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span>
+                                                <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">])</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="c">## add parameters name with checkbox for selecting to fit</span>
+                    <span class="n">cb</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">item</span><span class="p">)</span>
+                    <span class="n">cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">CHECK_STATE</span><span class="p">)</span>
+                    <span class="n">cb</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot; Check mark to fit.&quot;</span><span class="p">)</span>
+                    <span class="c">#cb.SetValue(True)</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">EVT_CHECKBOX</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cb</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">select_param</span><span class="p">)</span>
+                    
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">cb</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                              <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+
+                    <span class="c">## add parameter value</span>
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                    <span class="n">ctl1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                        <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+                    <span class="n">ctl1</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+                                <span class="s">&quot;Hit &#39;Enter&#39; after typing to update the plot.&quot;</span><span class="p">)</span>
+                    <span class="n">ctl1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="bp">True</span><span class="p">))</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl1</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+                    <span class="c">## text to show error sign</span>
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">text2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;+/-&#39;</span><span class="p">)</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">text2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                              <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+                        <span class="n">text2</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">ctl2</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                       <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">1.2</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                              <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+                        <span class="n">ctl2</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                    
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">ctl3</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">1.9</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                              <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onparamRangeEnter</span><span class="p">)</span>
+         
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl3</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                              <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">ctl4</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">1.9</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                              <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onparamRangeEnter</span><span class="p">)</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl4</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                              <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">FIXED_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+    
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="c"># Units</span>
+                    <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+                        <span class="n">units</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_LEFT</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">units</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;&quot;</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">ALIGN_LEFT</span><span class="p">)</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">units</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                              <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                        
+                    <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">cb</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">ctl1</span><span class="p">,</span>
+                                            <span class="n">text2</span><span class="p">,</span> <span class="n">ctl2</span><span class="p">,</span> <span class="n">ctl3</span><span class="p">,</span> <span class="n">ctl4</span><span class="p">,</span> <span class="n">units</span><span class="p">])</span>
+                                  
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                  <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        
+        <span class="c"># type can be either Guassian or Array</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="nb">type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">values</span><span class="p">()[</span><span class="mi">0</span><span class="p">][</span><span class="s">&quot;type&quot;</span><span class="p">]</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="nb">type</span> <span class="o">=</span> <span class="s">&quot;Gaussian&quot;</span>
+            
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">#Add tile for orientational angle</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                <span class="n">orient_angle</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[For 2D only]:&#39;</span><span class="p">)</span>
+                <span class="n">mag_on_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Magnetic ON&quot;</span> <span class="p">)</span>
+                <span class="n">mag_on_button</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_mag_on</span><span class="p">)</span>
+                <span class="n">mag_help_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&quot;Magnetic angles?&quot;</span> <span class="p">)</span>
+                <span class="n">mag_help_button</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_BUTTON</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">_on_mag_help</span><span class="p">)</span>
+                <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">orient_angle</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                          <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+                <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+                <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">mag_on_button</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span> <span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> 
+                          <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span> 
+                <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">mag_help_button</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span> <span class="o">+</span> <span class="mi">1</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> 
+                          <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span> 
+                
+                <span class="c">#handle the magnetic buttons</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_has_magnetic</span><span class="p">:</span>
+                    <span class="n">mag_on_button</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="k">elif</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+                    <span class="n">mag_on_button</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">mag_on_button</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="n">mag_help_button</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">mag_on_button</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span><span class="p">:</span>
+                        <span class="n">mag_on_button</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;Magnetic OFF&quot;</span><span class="p">)</span>
+                        <span class="n">mag_help_button</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span> 
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">mag_on_button</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;Magnetic ON&quot;</span><span class="p">)</span>
+                        <span class="n">mag_help_button</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                        
+                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">and</span> \
+                        <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                    <span class="n">orient_angle</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">orient_angle</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="k">break</span>
+      
+        <span class="c">#For Gaussian only</span>
+        <span class="k">if</span> <span class="nb">type</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;array&quot;</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+                        <span class="k">continue</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span><span class="p">:</span>
+                    <span class="c">##prepare a spot to store min max</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>
+                          
+                    <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+                    <span class="c">## add parameters name with checkbox for selecting to fit</span>
+                    <span class="n">cb</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">item</span><span class="p">)</span>
+                    <span class="n">cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">CHECK_STATE</span><span class="p">)</span>
+                    <span class="n">cb</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Check mark to fit&quot;</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="bp">self</span><span class="p">,</span> <span class="n">cb</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">select_param</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                            <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                        <span class="n">cb</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">cb</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">cb</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                              <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+    
+                    <span class="c">## add parameter value</span>
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                    <span class="n">ctl1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                        <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">)</span>
+                    <span class="n">ctl1</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span>\
+                                <span class="s">&quot;Hit &#39;Enter&#39; after typing to update the plot.&quot;</span><span class="p">)</span>
+                    <span class="n">ctl1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="bp">True</span><span class="p">))</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                            <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                        <span class="n">ctl1</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">ctl1</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl1</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+                    <span class="c">## text to show error sign</span>
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">text2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;+/-&#39;</span><span class="p">)</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">text2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> \
+                              <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+
+                    <span class="n">text2</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">ctl2</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                       <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">1.2</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                              <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+
+                    <span class="n">ctl2</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                    
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">ctl3</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">1.8</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                              <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onparamRangeEnter</span><span class="p">)</span>
+                    
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl3</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                              <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                    <span class="n">ctl3</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                 
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">ctl4</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ModelTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span> <span class="o">/</span> <span class="mf">1.8</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                              <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                            <span class="n">text_enter_callback</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_onparamRangeEnter</span><span class="p">)</span>
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ctl4</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                              <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                   
+                    <span class="n">ctl4</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                    
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                            <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_mac</span><span class="p">:</span>
+                            <span class="n">text2</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                            <span class="n">ctl2</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                        <span class="n">ctl3</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                        <span class="n">ctl4</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    
+                    <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="c"># Units</span>
+                    <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+                        <span class="n">units</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                              <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span>
+                                              <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">ALIGN_LEFT</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">units</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;&quot;</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">ALIGN_LEFT</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                            <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+                        <span class="n">units</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">units</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+                    
+                    <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">units</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                              <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+                                          
+                    <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">cb</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">ctl1</span><span class="p">,</span>
+                                            <span class="n">text2</span><span class="p">,</span> <span class="n">ctl2</span><span class="p">,</span> <span class="n">ctl3</span><span class="p">,</span> <span class="n">ctl4</span><span class="p">,</span> <span class="n">units</span><span class="p">])</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">cb</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">ctl1</span><span class="p">,</span>
+                                            <span class="n">text2</span><span class="p">,</span> <span class="n">ctl2</span><span class="p">,</span> <span class="n">ctl3</span><span class="p">,</span> <span class="n">ctl4</span><span class="p">,</span> <span class="n">units</span><span class="p">])</span>
+              
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">box_description</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">BLUE</span><span class="p">)</span>
+        <span class="c">#Display units text on panel</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">text2_4</span><span class="o">.</span><span class="n">Show</span><span class="p">()</span>
+        <span class="c">#Fill the list of fittable parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">get_all_checked_params</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_current_state_fit</span><span class="p">()</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer1</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="FitPage.on_right_down"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.FitPage.on_right_down">[docs]</a>    <span class="k">def</span> <span class="nf">on_right_down</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get key stroke event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c"># Figuring out key combo: Cmd for copy, Alt for paste</span>
+        <span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">AltDown</span><span class="p">()</span> <span class="ow">and</span> <span class="n">event</span><span class="o">.</span><span class="n">ShiftDown</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">show_ftol_dialog</span><span class="p">()</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">elif</span> <span class="n">event</span><span class="o">.</span><span class="n">AltDown</span><span class="p">()</span> <span class="ow">or</span> <span class="n">event</span><span class="o">.</span><span class="n">ShiftDown</span><span class="p">():</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c"># make event free</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="c"># messages depending on the flag</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Could not open ftol dialog;&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; Check if the Scipy fit engine is selected in the menubar.&quot;</span>
+            <span class="n">infor</span> <span class="o">=</span> <span class="s">&#39;warning&#39;</span>
+            <span class="c"># inform msg to wx</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                        <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="n">infor</span><span class="p">))</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_onModel2D</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        toggle view of model from 1D to 2D  or 2D from 1D</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">GetLabelText</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;Show 2D&quot;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;Show 1D&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span> <span class="o">=</span> <span class="bp">True</span>
+              
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_view</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;Show 2D&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">create_default_data</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">store_data</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span> <span class="n">data_list</span><span class="o">=</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">])</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_model_param_sizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_sizer_dispersion</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_weight</span><span class="p">(</span><span class="n">is_2D</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_smear_buttons</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">enable2D</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="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_set_smear_buttons</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set semarer radio buttons</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># more disables for 2D</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">or</span> \
+                    <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">default_mask</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="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">mask</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            
+            </div>
+<div class="viewcode-block" id="BGTextCtrl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpage.BGTextCtrl">[docs]</a><span class="k">class</span> <span class="nc">BGTextCtrl</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Text control used to display outputs.</span>
+<span class="sd">    No editing allowed. The background is</span>
+<span class="sd">    grayed out. User can&#39;t select text.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetParent</span><span class="p">()</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">GetBackgroundColour</span><span class="p">())</span>
+        
+        <span class="c"># Bind to mouse event to avoid text highlighting</span>
+        <span class="c"># The event will be skipped once the call-back</span>
+        <span class="c"># is called.</span>
+        <span class="bp">self</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_MOUSE_EVENTS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_click</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_click</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Prevent further handling of the mouse event</span>
+<span class="sd">        by not calling Skip().</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">pass</span></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/fitpanel.html
===================================================================
--- _modules/sas/perspectives/fitting/fitpanel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/fitpanel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,739 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.fitpanel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.fitpanel</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">FitPanel class contains fields allowing to fit  models and  data</span>
+
+<span class="sd">:note: For Fit to be performed the user should check at least one parameter</span>
+<span class="sd">    on fit Panel window.</span>
+<span class="sd">   </span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">from</span> <span class="nn">wx.aui</span> <span class="kn">import</span> <span class="n">AuiNotebook</span> <span class="k">as</span> <span class="n">nb</span>
+
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">PanelOnFocusEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">check_data_validity</span>
+
+<span class="kn">import</span> <span class="nn">basepage</span>
+<span class="kn">import</span> <span class="nn">models</span>
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">80</span>
+
+
+<div class="viewcode-block" id="FitPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel">[docs]</a><span class="k">class</span> <span class="nc">FitPanel</span><span class="p">(</span><span class="n">nb</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    FitPanel class contains fields allowing to fit  models and  data</span>
+<span class="sd">    </span>
+<span class="sd">    :note: For Fit to be performed the user should check at least one parameter</span>
+<span class="sd">        on fit Panel window.</span>
+<span class="sd">       </span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal name for the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;Fit panel&quot;</span>
+    <span class="c">## Title to appear on top of the window</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;Fit Panel &quot;</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">True</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">nb</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">aui</span><span class="o">.</span><span class="n">AUI_NB_WINDOWLIST_BUTTON</span><span class="o">|</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">aui</span><span class="o">.</span><span class="n">AUI_NB_DEFAULT_STYLE</span><span class="o">|</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">CLIP_CHILDREN</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">)</span>
+        <span class="c">#self.SetWindowStyleFlag(style=nb.FNB_FANCY_TABS)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">event_owner</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#dictionary of miodel {model class name, model class}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu_mng</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">ModelManager</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">menu_mng</span><span class="o">.</span><span class="n">get_model_list</span><span class="p">()</span>
+        <span class="c">#pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">menu_mng</span><span class="o">.</span><span class="n">get_model_dictionary</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pageClosedEvent</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">aui</span><span class="o">.</span><span class="n">EVT_AUINOTEBOOK_PAGE_CLOSE</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pageClosedEvent</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close_page</span><span class="p">)</span>
+        <span class="c">## save the title of the last page tab added</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_name</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c">## list of existing fit page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c">#index of fit page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_index</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">#index of batch page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_page_index</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">#page of simultaneous fit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_engine_type</span> <span class="o">=</span> <span class="s">&quot;bumps&quot;</span>
+        <span class="c">## get the state of a page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">basepage</span><span class="o">.</span><span class="n">EVT_PAGE_INFO</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onGetstate</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">basepage</span><span class="o">.</span><span class="n">EVT_PREVIOUS_STATE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onUndo</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">basepage</span><span class="o">.</span><span class="n">EVT_NEXT_STATE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onRedo</span><span class="p">)</span>
+        <span class="bp">self</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">aui</span><span class="o">.</span><span class="n">EVT_AUINOTEBOOK_PAGE_CHANGED</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_page_changing</span><span class="p">)</span>
+        <span class="bp">self</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">aui</span><span class="o">.</span><span class="n">EVT_AUINOTEBOOK_PAGE_CLOSED</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_closed</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="FitPanel.on_closed"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.on_closed">[docs]</a>    <span class="k">def</span> <span class="nf">on_closed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageCount</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">add_empty_page</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">enable_close_button</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="FitPanel.save_project"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.save_project">[docs]</a>    <span class="k">def</span> <span class="nf">save_project</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">doc</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return an xml node containing state of the panel</span>
+<span class="sd">         that guiframe can write to file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">uid</span><span class="p">,</span> <span class="n">page</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="k">if</span> <span class="n">page</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+                <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageIndex</span><span class="p">(</span><span class="n">page</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">pos</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span> <span class="ow">and</span> <span class="n">page</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="p">]:</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> .</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetPageText</span><span class="p">(</span><span class="n">pos</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">page</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+                <span class="c"># state must be cloned</span>
+                <span class="n">state</span> <span class="o">=</span> <span class="n">page</span><span class="o">.</span><span class="n">get_state</span><span class="p">()</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">page</span><span class="o">.</span><span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">new_doc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">state_reader</span><span class="o">.</span><span class="n">write_toXML</span><span class="p">(</span><span class="n">data</span><span class="p">,</span>
+                                                                     <span class="n">state</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">doc</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="s">&quot;firstChild&quot;</span><span class="p">):</span>
+                        <span class="n">child</span> <span class="o">=</span> <span class="n">new_doc</span><span class="o">.</span><span class="n">firstChild</span><span class="o">.</span><span class="n">firstChild</span>
+                        <span class="n">doc</span><span class="o">.</span><span class="n">firstChild</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">child</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">doc</span> <span class="o">=</span> <span class="n">new_doc</span>
+        <span class="k">if</span> <span class="n">msg</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="n">temp</span> <span class="o">=</span> <span class="s">&quot;Save Project is not supported for Batch page.</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">temp</span> <span class="o">+=</span> <span class="s">&quot;The following pages will not be save:</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">message</span> <span class="o">=</span> <span class="n">temp</span> <span class="o">+</span> <span class="n">msg</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="p">,</span>
+                                                            <span class="n">info</span><span class="o">=</span><span class="s">&quot;warning&quot;</span><span class="p">))</span>
+        <span class="k">return</span> <span class="n">doc</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_on_engine_change</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;scipy&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">panel</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_engine_helper</span><span class="p">(</span><span class="n">panel</span><span class="o">=</span><span class="n">panel</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">)</span>
+            
+<div class="viewcode-block" id="FitPanel.set_engine_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.set_engine_helper">[docs]</a>    <span class="k">def</span> <span class="nf">set_engine_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">panel</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;scipy&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_engine_type</span> <span class="o">=</span> <span class="n">name</span>
+        <span class="k">if</span> <span class="n">panel</span> <span class="ow">not</span> <span class="ow">in</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="p">]:</span>
+            <span class="n">panel</span><span class="o">.</span><span class="n">_on_engine_change</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_engine_type</span><span class="p">)</span>
+                </div>
+<div class="viewcode-block" id="FitPanel.update_model_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.update_model_list">[docs]</a>    <span class="k">def</span> <span class="nf">update_model_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">temp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">menu_mng</span><span class="o">.</span><span class="n">update</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">temp</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="n">temp</span>
+        <span class="k">return</span> <span class="n">temp</span>
+    </div>
+<div class="viewcode-block" id="FitPanel.reset_pmodel_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.reset_pmodel_list">[docs]</a>    <span class="k">def</span> <span class="nf">reset_pmodel_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">temp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">menu_mng</span><span class="o">.</span><span class="n">pulgins_reset</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">temp</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="n">temp</span>
+        <span class="k">return</span> <span class="n">temp</span>
+    </div>
+<div class="viewcode-block" id="FitPanel.get_page_by_id"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.get_page_by_id">[docs]</a>    <span class="k">def</span> <span class="nf">get_page_by_id</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">uid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">uid</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fitpanel cannot find ID: </span><span class="si">%s</span><span class="s"> in self.opened_pages&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">uid</span><span class="p">)</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">msg</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span>
+        </div>
+<div class="viewcode-block" id="FitPanel.on_page_changing"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.on_page_changing">[docs]</a>    <span class="k">def</span> <span class="nf">on_page_changing</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        calls the function when the current event handler has exited. avoiding</span>
+<span class="sd">        to call panel on focus on a panel that is currently deleted</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">helper_on_page_change</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="FitPanel.helper_on_page_change"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.helper_on_page_change">[docs]</a>    <span class="k">def</span> <span class="nf">helper_on_page_change</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">pos</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">selected_page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPage</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                         <span class="n">PanelOnFocusEvent</span><span class="p">(</span><span class="n">panel</span><span class="o">=</span><span class="n">selected_page</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_close_button</span><span class="p">()</span>
+       </div>
+<div class="viewcode-block" id="FitPanel.on_set_focus"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.on_set_focus">[docs]</a>    <span class="k">def</span> <span class="nf">on_set_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">pos</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">selected_page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPage</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                         <span class="n">PanelOnFocusEvent</span><span class="p">(</span><span class="n">panel</span><span class="o">=</span><span class="n">selected_page</span><span class="p">))</span>
+        </div>
+<div class="viewcode-block" id="FitPanel.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.get_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get the data in the current page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">pos</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">selected_page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPage</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="k">return</span> <span class="n">selected_page</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="FitPanel.set_model_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.set_model_state">[docs]</a>    <span class="k">def</span> <span class="nf">set_model_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        receive a state to reset the model in the current page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">pos</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">selected_page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPage</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="n">selected_page</span><span class="o">.</span><span class="n">set_model_state</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="FitPanel.get_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.get_state">[docs]</a>    <span class="k">def</span> <span class="nf">get_state</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">         return the state of the current selected page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">pos</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
+            <span class="n">selected_page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPage</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="k">return</span> <span class="n">selected_page</span><span class="o">.</span><span class="n">get_state</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="FitPanel.close_all"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.close_all">[docs]</a>    <span class="k">def</span> <span class="nf">close_all</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        remove all pages, used when a svs file is opened</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        
+        <span class="c">#get number of pages</span>
+        <span class="n">nop</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageCount</span><span class="p">()</span>
+        <span class="c">#use while-loop, for-loop will not do the job well.</span>
+        <span class="k">while</span> <span class="p">(</span><span class="n">nop</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">):</span>
+            <span class="c">#delete the first page until no page exists</span>
+            <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPage</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">panel_on_focus</span> <span class="o">==</span> <span class="n">page</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">panel_on_focus</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_close_helper</span><span class="p">(</span><span class="n">selected_page</span><span class="o">=</span><span class="n">page</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">DeletePage</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+            <span class="n">nop</span> <span class="o">=</span> <span class="n">nop</span> <span class="o">-</span> <span class="mi">1</span>
+            
+        <span class="c">## save the title of the last page tab added</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_name</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c">## list of existing fit page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span> <span class="o">=</span> <span class="p">{}</span>
+         </div>
+<div class="viewcode-block" id="FitPanel.set_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.set_state">[docs]</a>    <span class="k">def</span> <span class="nf">set_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Restore state of the panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">page_is_opened</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="n">state</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">uid</span><span class="p">,</span> <span class="n">panel</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="c">#Don&#39;t return any panel is the exact same page is created</span>
+                <span class="k">if</span> <span class="n">uid</span> <span class="o">==</span> <span class="n">panel</span><span class="o">.</span><span class="n">uid</span> <span class="ow">and</span> <span class="n">panel</span><span class="o">.</span><span class="n">data</span> <span class="o">==</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="p">:</span>
+                    <span class="c"># the page is still opened</span>
+                    <span class="n">panel</span><span class="o">.</span><span class="n">reset_page</span><span class="p">(</span><span class="n">state</span><span class="o">=</span><span class="n">state</span><span class="p">)</span>
+                    <span class="n">panel</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+                    <span class="n">page_is_opened</span> <span class="o">=</span> <span class="bp">True</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">page_is_opened</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&#39;list&#39;</span><span class="p">:</span>
+                    <span class="c">#To support older state file format</span>
+                    <span class="n">list_data</span> <span class="o">=</span> <span class="p">[</span><span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="p">]</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="c">#Todo: need new file format for the list</span>
+                    <span class="n">list_data</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span>
+                <span class="n">panel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">add_fit_page</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">list_data</span><span class="p">)</span>
+                <span class="c"># add data associated to the page created</span>
+                <span class="k">if</span> <span class="n">panel</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">store_data</span><span class="p">(</span><span class="n">uid</span><span class="o">=</span><span class="n">panel</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span>
+                                             <span class="n">data_list</span><span class="o">=</span><span class="n">list_data</span><span class="p">,</span>
+                                             <span class="n">caption</span><span class="o">=</span><span class="n">panel</span><span class="o">.</span><span class="n">window_caption</span><span class="p">)</span>
+                    <span class="n">panel</span><span class="o">.</span><span class="n">reset_page</span><span class="p">(</span><span class="n">state</span><span class="o">=</span><span class="n">state</span><span class="p">)</span>
+                    <span class="n">panel</span><span class="o">.</span><span class="n">save_current_state</span><span class="p">()</span>
+                    </div>
+<div class="viewcode-block" id="FitPanel.clear_panel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.clear_panel">[docs]</a>    <span class="k">def</span> <span class="nf">clear_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Clear and close all panels, used by guimanager</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+       
+        <span class="c">#close all panels only when svs file opened</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">close_all</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">mypanels</span> <span class="o">=</span> <span class="p">[]</span>
+        </div>
+<div class="viewcode-block" id="FitPanel.on_close_page"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.on_close_page">[docs]</a>    <span class="k">def</span> <span class="nf">on_close_page</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        close page and remove all references to the closed page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">nbr_page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageCount</span><span class="p">()</span>
+        <span class="n">selected_page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPage</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">())</span>
+        <span class="k">if</span> <span class="n">nbr_page</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">selected_page</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">event</span><span class="o">.</span><span class="n">Veto</span><span class="p">()</span>
+                <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_close_helper</span><span class="p">(</span><span class="n">selected_page</span><span class="o">=</span><span class="n">selected_page</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="FitPanel.close_page_with_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.close_page_with_data">[docs]</a>    <span class="k">def</span> <span class="nf">close_page_with_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">deleted_data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        close a fit page when its data is completely remove from the graph</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">deleted_data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">for</span> <span class="n">index</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetPageCount</span><span class="p">()):</span>
+            <span class="n">selected_page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPage</span><span class="p">(</span><span class="n">index</span><span class="p">)</span>
+            <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">selected_page</span><span class="p">,</span> <span class="s">&quot;get_data&quot;</span><span class="p">):</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">selected_page</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+                
+                <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="c">#the fitpanel exists and only the initial fit page is open</span>
+                    <span class="c">#with no selected data</span>
+                    <span class="k">return</span>
+                <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">deleted_data</span><span class="o">.</span><span class="n">id</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_close_helper</span><span class="p">(</span><span class="n">selected_page</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">DeletePage</span><span class="p">(</span><span class="n">index</span><span class="p">)</span>
+                    <span class="k">break</span>
+        </div>
+<div class="viewcode-block" id="FitPanel.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.set_manager">[docs]</a>    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set panel manager</span>
+<span class="sd">        </span>
+<span class="sd">        :param manager: instance of plugin fitting</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="n">manager</span>
+        <span class="k">for</span> <span class="n">pos</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetPageCount</span><span class="p">()):</span>
+            <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPage</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">page</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">page</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="FitPanel.set_model_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.set_model_list">[docs]</a>    <span class="k">def</span> <span class="nf">set_model_list</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        copy a dictionary of model into its own dictionary</span>
+<span class="sd">        </span>
+<span class="sd">        :param m_dict: dictionnary made of model name as key and model class</span>
+<span class="sd">        as value</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="nb">dict</span>
+        </div>
+<div class="viewcode-block" id="FitPanel.set_model_dict"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.set_model_dict">[docs]</a>    <span class="k">def</span> <span class="nf">set_model_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m_dict</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        copy a dictionary of model name -&gt; model object</span>
+
+<span class="sd">        :param m_dict: dictionary linking model name -&gt; model object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+</div>
+<div class="viewcode-block" id="FitPanel.get_current_page"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.get_current_page">[docs]</a>    <span class="k">def</span> <span class="nf">get_current_page</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: the current page selected</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPage</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">())</span>
+    </div>
+<div class="viewcode-block" id="FitPanel.add_sim_page"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.add_sim_page">[docs]</a>    <span class="k">def</span> <span class="nf">add_sim_page</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">caption</span><span class="o">=</span><span class="s">&quot;Const &amp; Simul Fit&quot;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Add the simultaneous fit page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">simfitpage</span> <span class="kn">import</span> <span class="n">SimultaneousFitPage</span>
+        <span class="n">page_finder</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">get_page_finder</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">caption</span> <span class="o">==</span> <span class="s">&quot;Const &amp; Simul Fit&quot;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span> <span class="o">=</span> <span class="n">SimultaneousFitPage</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">page_finder</span><span class="o">=</span><span class="n">page_finder</span><span class="p">,</span>
+                                                 <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">batch_on</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">window_caption</span> <span class="o">=</span> <span class="n">caption</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">window_name</span> <span class="o">=</span> <span class="n">caption</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">uid</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">AddPage</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="p">,</span> <span class="n">caption</span><span class="p">,</span> <span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">enable_close_button</span><span class="p">()</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span> <span class="o">=</span> <span class="n">SimultaneousFitPage</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">batch_on</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+                                                   <span class="n">page_finder</span><span class="o">=</span><span class="n">page_finder</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="o">.</span><span class="n">window_caption</span> <span class="o">=</span> <span class="n">caption</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="o">.</span><span class="n">window_name</span> <span class="o">=</span> <span class="n">caption</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="o">.</span><span class="n">uid</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">AddPage</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="p">,</span> <span class="n">caption</span><span class="p">,</span> <span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">enable_close_button</span><span class="p">()</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span>
+ </div>
+<div class="viewcode-block" id="FitPanel.add_empty_page"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.add_empty_page">[docs]</a>    <span class="k">def</span> <span class="nf">add_empty_page</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        add an empty page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        if self.batch_on:</span>
+<span class="sd">            from batchfitpage import BatchFitPage</span>
+<span class="sd">            panel = BatchFitPage(parent=self)</span>
+<span class="sd">            #Increment index of batch page</span>
+<span class="sd">            self.batch_page_index += 1</span>
+<span class="sd">            index = self.batch_page_index</span>
+<span class="sd">        else:</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">fitpage</span> <span class="kn">import</span> <span class="n">FitPage</span>
+        <span class="n">panel</span> <span class="o">=</span> <span class="n">FitPage</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_page_index</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">caption</span> <span class="o">=</span> <span class="s">&quot;BatchPage&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">batch_page_index</span><span class="p">)</span>
+            <span class="n">panel</span><span class="o">.</span><span class="n">set_index_model</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">batch_page_index</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c">#Increment index of fit page</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_index</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">caption</span> <span class="o">=</span> <span class="s">&quot;FitPage&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_page_index</span><span class="p">)</span>
+            <span class="n">panel</span><span class="o">.</span><span class="n">set_index_model</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_page_index</span><span class="p">)</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">batch_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="ow">not</span> <span class="n">panel</span><span class="o">.</span><span class="n">batch_on</span><span class="p">)</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">set_model_dictionary</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">)</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">populate_box</span><span class="p">(</span><span class="n">model_dict</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">)</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">formfactor_combo_init</span><span class="p">()</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="p">)</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">window_caption</span> <span class="o">=</span> <span class="n">caption</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">window_name</span> <span class="o">=</span> <span class="n">caption</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">AddPage</span><span class="p">(</span><span class="n">panel</span><span class="p">,</span> <span class="n">caption</span><span class="p">,</span> <span class="n">select</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="p">[</span><span class="n">panel</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span> <span class="o">=</span> <span class="n">panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_engine_helper</span><span class="p">(</span><span class="n">panel</span><span class="o">=</span><span class="n">panel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">create_fit_problem</span><span class="p">(</span><span class="n">panel</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">panel</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="n">panel</span><span class="o">.</span><span class="n">get_data</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_close_button</span><span class="p">()</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">on_set_focus</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">panel</span>
+    </div>
+<div class="viewcode-block" id="FitPanel.enable_close_button"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.enable_close_button">[docs]</a>    <span class="k">def</span> <span class="nf">enable_close_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        display the close button on tab for more than 1 tabs else remove the</span>
+<span class="sd">        close button</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageCount</span><span class="p">()</span> <span class="o">&lt;=</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="n">style</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetWindowStyleFlag</span><span class="p">()</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">aui</span><span class="o">.</span><span class="n">AUI_NB_CLOSE_ON_ACTIVE_TAB</span>
+            <span class="k">if</span> <span class="n">style</span> <span class="o">&amp;</span> <span class="n">wx</span><span class="o">.</span><span class="n">aui</span><span class="o">.</span><span class="n">AUI_NB_CLOSE_ON_ACTIVE_TAB</span> <span class="o">==</span> <span class="n">flag</span><span class="p">:</span>
+                <span class="n">style</span> <span class="o">=</span> <span class="n">style</span> <span class="o">&amp;</span> <span class="o">~</span><span class="n">wx</span><span class="o">.</span><span class="n">aui</span><span class="o">.</span><span class="n">AUI_NB_CLOSE_ON_ACTIVE_TAB</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowStyle</span><span class="p">(</span><span class="n">style</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">style</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetWindowStyleFlag</span><span class="p">()</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">aui</span><span class="o">.</span><span class="n">AUI_NB_CLOSE_ON_ACTIVE_TAB</span>
+            <span class="k">if</span> <span class="n">style</span> <span class="o">&amp;</span> <span class="n">wx</span><span class="o">.</span><span class="n">aui</span><span class="o">.</span><span class="n">AUI_NB_CLOSE_ON_ACTIVE_TAB</span> <span class="o">!=</span> <span class="n">flag</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">aui</span><span class="o">.</span><span class="n">AUI_NB_CLOSE_ON_ACTIVE_TAB</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowStyle</span><span class="p">(</span><span class="n">style</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="FitPanel.delete_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.delete_data">[docs]</a>    <span class="k">def</span> <span class="nf">delete_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Delete the given data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&quot;list&quot;</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;Fitpanel delete_data expect list of id&quot;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">n</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageCount</span><span class="p">()</span>
+            <span class="k">for</span> <span class="n">page</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
+                <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageIndex</span><span class="p">(</span><span class="n">page</span><span class="p">)</span>
+                <span class="n">temp_data</span> <span class="o">=</span> <span class="n">page</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">temp_data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">temp_data</span><span class="o">.</span><span class="n">id</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">on_close_page</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+                    <span class="n">temp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">DeletePage</span><span class="p">(</span><span class="n">temp</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageCount</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">on_add_new_page</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="FitPanel.set_data_on_batch_mode"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.set_data_on_batch_mode">[docs]</a>    <span class="k">def</span> <span class="nf">set_data_on_batch_mode</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Add all data to a single tab when the application is on Batch mode.</span>
+<span class="sd">        However all data in the set of data must be either 1D or 2D type. </span>
+<span class="sd">        This method presents option to select the data type before creating a </span>
+<span class="sd">        tab.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data_1d_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">data_2d_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">group_id_1d</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="c"># separate data into data1d and data2d list</span>
+        <span class="k">for</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">data_list</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data1D&quot;</span><span class="p">:</span>
+                <span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">group_id_1d</span>
+                <span class="n">data_1d_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+                <span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+                <span class="n">data_2d_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="n">page</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
+            <span class="c">#check if there is an empty page to fill up</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">check_data_validity</span><span class="p">(</span><span class="n">p</span><span class="o">.</span><span class="n">get_data</span><span class="p">())</span> <span class="ow">and</span> <span class="n">p</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+                
+                <span class="c">#make sure data get placed in 1D empty tab if data is 1D</span>
+                <span class="c">#else data get place on 2D tab empty tab</span>
+                <span class="n">enable2D</span> <span class="o">=</span> <span class="n">p</span><span class="o">.</span><span class="n">get_view_mode</span><span class="p">()</span>
+                <span class="k">if</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">and</span> <span class="n">enable2D</span><span class="p">)</span>\
+                <span class="ow">or</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data1D&quot;</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">enable2D</span><span class="p">):</span>
+                    <span class="n">page</span> <span class="o">=</span> <span class="n">p</span>
+                    <span class="k">break</span>
+        <span class="k">if</span> <span class="n">data_1d_list</span> <span class="ow">and</span> <span class="n">data_2d_list</span><span class="p">:</span>
+            <span class="c"># need to warning the user that this batch is a special case</span>
+            <span class="kn">from</span> <span class="nn">sas</span> <span class="kn">import</span> <span class="n">BatchDataDialog</span>
+            <span class="n">dlg</span> <span class="o">=</span> <span class="n">BatchDataDialog</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+                <span class="n">data_type</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+                <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">page</span>  <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">add_empty_page</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">data_type</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                    <span class="c">#user has selected only data1D</span>
+                    <span class="n">page</span><span class="o">.</span><span class="n">fill_data_combobox</span><span class="p">(</span><span class="n">data_1d_list</span><span class="p">)</span>
+                <span class="k">elif</span> <span class="n">data_type</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+                    <span class="n">page</span><span class="o">.</span><span class="n">fill_data_combobox</span><span class="p">(</span><span class="n">data_2d_list</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="c">#the batch analysis is canceled</span>
+                <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">page</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">add_empty_page</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">data_1d_list</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">data_2d_list</span><span class="p">:</span>
+                <span class="c">#only on type of data</span>
+                <span class="n">page</span><span class="o">.</span><span class="n">fill_data_combobox</span><span class="p">(</span><span class="n">data_1d_list</span><span class="p">)</span>
+            <span class="k">elif</span> <span class="ow">not</span> <span class="n">data_1d_list</span> <span class="ow">and</span> <span class="n">data_2d_list</span><span class="p">:</span>
+                <span class="n">page</span><span class="o">.</span><span class="n">fill_data_combobox</span><span class="p">(</span><span class="n">data_2d_list</span><span class="p">)</span>
+                
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageIndex</span><span class="p">(</span><span class="n">page</span><span class="p">)</span>
+        <span class="n">page</span><span class="o">.</span><span class="n">batch_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span>
+        <span class="n">page</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="ow">not</span> <span class="n">page</span><span class="o">.</span><span class="n">batch_on</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="p">[</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span> <span class="o">=</span> <span class="n">page</span>
+        <span class="k">return</span> <span class="n">page</span>
+    </div>
+<div class="viewcode-block" id="FitPanel.set_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitpanel.FitPanel.set_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Add a fitting page on the notebook contained by fitpanel</span>
+<span class="sd">        </span>
+<span class="sd">        :param data: data to fit</span>
+<span class="sd">        </span>
+<span class="sd">        :return panel : page just added for further used.</span>
+<span class="sd">        is used by fitting module</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">data_list</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_data_on_batch_mode</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">data_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="c"># for &#39;fitv&#39; files</span>
+                <span class="n">data_list</span> <span class="o">=</span> <span class="p">[</span><span class="n">data</span><span class="p">]</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">data_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                
+            <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">for</span> <span class="n">page</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
+            <span class="c">#check if the selected data existing in the fitpanel</span>
+            <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageIndex</span><span class="p">(</span><span class="n">page</span><span class="p">)</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">check_data_validity</span><span class="p">(</span><span class="n">page</span><span class="o">.</span><span class="n">get_data</span><span class="p">())</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">page</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+                <span class="c">#make sure data get placed in 1D empty tab if data is 1D</span>
+                <span class="c">#else data get place on 2D tab empty tab</span>
+                <span class="n">enable2D</span> <span class="o">=</span> <span class="n">page</span><span class="o">.</span><span class="n">get_view_mode</span><span class="p">()</span>
+                <span class="k">if</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span> <span class="ow">and</span> <span class="n">enable2D</span><span class="p">)</span>\
+                <span class="ow">or</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data1D&quot;</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">enable2D</span><span class="p">):</span>
+                    <span class="n">page</span><span class="o">.</span><span class="n">batch_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span>
+                    <span class="n">page</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="ow">not</span> <span class="n">page</span><span class="o">.</span><span class="n">batch_on</span><span class="p">)</span>
+                    <span class="n">page</span><span class="o">.</span><span class="n">fill_data_combobox</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span>
+                    <span class="c">#caption = &quot;FitPage&quot; + str(self.fit_page_index)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">SetPageText</span><span class="p">(</span><span class="n">pos</span><span class="p">,</span> <span class="n">page</span><span class="o">.</span><span class="n">window_caption</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+                    <span class="k">return</span> <span class="n">page</span>
+        <span class="c">#create new page and add data</span>
+        <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">add_empty_page</span><span class="p">()</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageIndex</span><span class="p">(</span><span class="n">page</span><span class="p">)</span>
+        <span class="n">page</span><span class="o">.</span><span class="n">fill_data_combobox</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="p">[</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span> <span class="o">=</span> <span class="n">page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">page</span>
+       </div>
+    <span class="k">def</span> <span class="nf">_onGetstate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        copy the state of a page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">page</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">page</span>
+        <span class="k">if</span> <span class="n">page</span><span class="o">.</span><span class="n">uid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_name</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_name</span><span class="p">[</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">appendItem</span><span class="p">(</span><span class="n">page</span><span class="o">.</span><span class="n">createMemento</span><span class="p">())</span>
+            
+    <span class="k">def</span> <span class="nf">_onUndo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the previous state of a given page is available</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">page</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">page</span>
+        <span class="k">if</span> <span class="n">page</span><span class="o">.</span><span class="n">uid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_name</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_name</span><span class="p">[</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">getCurrentPosition</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_name</span><span class="p">[</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">getPreviousItem</span><span class="p">()</span>
+                <span class="n">page</span><span class="o">.</span><span class="n">_redo</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">page</span><span class="o">.</span><span class="n">reset_page</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_onRedo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the next state available</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">page</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">page</span>
+        <span class="k">if</span> <span class="n">page</span><span class="o">.</span><span class="n">uid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_name</span><span class="p">:</span>
+            <span class="n">length</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_page_name</span><span class="p">[</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">])</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_name</span><span class="p">[</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">getCurrentPosition</span><span class="p">()</span> <span class="o">==</span> <span class="n">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">page</span><span class="o">.</span><span class="n">_redo</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="n">page</span><span class="o">.</span><span class="n">_redo</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_page_name</span><span class="p">[</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">getNextItem</span><span class="p">()</span>
+            <span class="n">page</span><span class="o">.</span><span class="n">reset_page</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+                 
+    <span class="k">def</span> <span class="nf">_close_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">selected_page</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Delete the given page from the notebook</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#remove hint page</span>
+        <span class="c">#if selected_page == self.hint_page:</span>
+        <span class="c">#    return</span>
+        <span class="c">## removing sim_page</span>
+        <span class="k">if</span> <span class="n">selected_page</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">sim_page</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="n">selected_page</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">batch_page</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">return</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        # The below is not working when delete #5 and still have #6.</span>
+<span class="sd">        if selected_page.__class__.__name__ == &quot;FitPage&quot;:</span>
+<span class="sd">            self.fit_page_index -= 1</span>
+<span class="sd">        else:</span>
+<span class="sd">            self.batch_page_index -= 1</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## closing other pages</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="n">selected_page</span><span class="o">.</span><span class="n">createMemento</span><span class="p">()</span>
+        <span class="n">page_finder</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">get_page_finder</span><span class="p">()</span>
+        <span class="c">## removing fit page</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="n">selected_page</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+        <span class="c">#Don&#39; t remove plot for 2D</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;Data2D&#39;</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="n">selected_page</span> <span class="ow">in</span> <span class="n">page_finder</span><span class="p">:</span>
+            <span class="c">#Delete the name of the page into the list of open page</span>
+            <span class="k">for</span> <span class="n">uid</span><span class="p">,</span> <span class="nb">list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="c">#Don&#39;t return any panel is the exact same page is created</span>
+                
+                <span class="k">if</span> <span class="n">flag</span> <span class="ow">and</span> <span class="n">selected_page</span><span class="o">.</span><span class="n">uid</span> <span class="o">==</span> <span class="n">uid</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">remove_plot</span><span class="p">(</span><span class="n">uid</span><span class="p">,</span> <span class="n">theory</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
+                    <span class="k">break</span>
+            <span class="k">del</span> <span class="n">page_finder</span><span class="p">[</span><span class="n">selected_page</span><span class="p">]</span>
+  
+        <span class="c">#Delete the name of the page into the list of open page</span>
+        <span class="k">for</span> <span class="n">uid</span><span class="p">,</span> <span class="nb">list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c">#Don&#39;t return any panel is the exact same page is created</span>
+            <span class="k">if</span> <span class="n">selected_page</span><span class="o">.</span><span class="n">uid</span> <span class="o">==</span> <span class="n">uid</span><span class="p">:</span>
+                <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">opened_pages</span><span class="p">[</span><span class="n">selected_page</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span>
+                <span class="k">break</span>
+        <span class="c">##remove the check box link to the model name of this page (selected_page)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">draw_page</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c">## that page is already deleted no need to remove check box on</span>
+            <span class="c">##non existing page</span>
+            <span class="k">pass</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="o">.</span><span class="n">draw_page</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c">## that page is already deleted no need to remove check box on</span>
+            <span class="c">##non existing page</span>
+            <span class="k">pass</span></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/fitproblem.html
===================================================================
--- _modules/sas/perspectives/fitting/fitproblem.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/fitproblem.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,848 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.fitproblem &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.fitproblem</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Inferface containing information to store data, model, range of data, etc...</span>
+<span class="sd">and retreive this information. This is an inferface</span>
+<span class="sd">for a fitProblem i.e relationship between data and model.</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation.</span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+<span class="kn">import</span> <span class="nn">copy</span>
+<span class="kn">from</span> <span class="nn">sas.models.qsmearing</span> <span class="kn">import</span> <span class="n">smear_selection</span>
+
+<div class="viewcode-block" id="FitProblemComponent"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent">[docs]</a><span class="k">class</span> <span class="nc">FitProblemComponent</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Inferface containing information to store data, model, range of data, etc...</span>
+<span class="sd">    and retreive this information. This is an inferface</span>
+<span class="sd">    for a fitProblem i.e relationship between data and model.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+<div class="viewcode-block" id="FitProblemComponent.enable_smearing"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.enable_smearing">[docs]</a>    <span class="k">def</span> <span class="nf">enable_smearing</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :param flag: bool.When flag is 1 get the computer smear value. When</span>
+<span class="sd">        flag is 0 ingore smear value.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_smearer"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_smearer">[docs]</a>    <span class="k">def</span> <span class="nf">get_smearer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return smear object</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="FitProblemComponent.save_model_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.save_model_name">[docs]</a>    <span class="k">def</span> <span class="nf">save_model_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.set_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.set_model">[docs]</a>    <span class="k">def</span> <span class="nf">set_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        associates each model with its new created name</span>
+<span class="sd">        :param model: model selected</span>
+<span class="sd">        :param name: name created for model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_model">[docs]</a>    <span class="k">def</span> <span class="nf">get_model</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: saved model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.set_residuals"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.set_residuals">[docs]</a>    <span class="k">def</span> <span class="nf">set_residuals</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">residuals</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save a copy of residual</span>
+<span class="sd">        :param data: data selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_residuals"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_residuals">[docs]</a>    <span class="k">def</span> <span class="nf">get_residuals</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: residuals</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.set_theory_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.set_theory_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_theory_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save a copy of the data select to fit</span>
+<span class="sd">        :param data: data selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_theory_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_theory_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_theory_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: list of data dList</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.set_fit_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.set_fit_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_fit_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">         Store of list of data and create  by create new fitproblem of each data</span>
+<span class="sd">         id , if there was existing information about model, this information</span>
+<span class="sd">         get copy to the new fitproblem</span>
+<span class="sd">        :param data: list of data selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_fit_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_fit_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_fit_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.set_model_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.set_model_param">[docs]</a>    <span class="k">def</span> <span class="nf">set_model_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store the name and value of a parameter of this fitproblem&#39;s model</span>
+<span class="sd">        :param name: name of the given parameter</span>
+<span class="sd">        :param value: value of that parameter</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.set_param2fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.set_param2fit">[docs]</a>    <span class="k">def</span> <span class="nf">set_param2fit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store param names to fit (checked)</span>
+<span class="sd">        :param list: list of the param names</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_param2fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_param2fit">[docs]</a>    <span class="k">def</span> <span class="nf">get_param2fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the list param names to fit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_model_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_model_param">[docs]</a>    <span class="k">def</span> <span class="nf">get_model_param</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return list of couple of parameter name and value</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.schedule_tofit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.schedule_tofit">[docs]</a>    <span class="k">def</span> <span class="nf">schedule_tofit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schedule</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set schedule to true to decide if this fit  must be performed</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_scheduled"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_scheduled">[docs]</a>    <span class="k">def</span> <span class="nf">get_scheduled</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return true or false if a problem as being schedule for fitting</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.set_range"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.set_range">[docs]</a>    <span class="k">def</span> <span class="nf">set_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">qmin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">qmax</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set fitting range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_range"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_range">[docs]</a>    <span class="k">def</span> <span class="nf">get_range</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: fitting range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.set_weight"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.set_weight">[docs]</a>    <span class="k">def</span> <span class="nf">set_weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set fitting range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_weight"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_weight">[docs]</a>    <span class="k">def</span> <span class="nf">get_weight</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get fitting weight</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.clear_model_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.clear_model_param">[docs]</a>    <span class="k">def</span> <span class="nf">clear_model_param</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        clear constraint info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.set_fit_tab_caption"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.set_fit_tab_caption">[docs]</a>    <span class="k">def</span> <span class="nf">set_fit_tab_caption</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">caption</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        store the caption of the page associated with object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_fit_tab_caption"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_fit_tab_caption">[docs]</a>    <span class="k">def</span> <span class="nf">get_fit_tab_caption</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return the caption of the page associated with object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.set_graph_id"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.set_graph_id">[docs]</a>    <span class="k">def</span> <span class="nf">set_graph_id</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set graph id (from data_group_id at the time the graph produced) </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        </div>
+<div class="viewcode-block" id="FitProblemComponent.get_graph_id"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_graph_id">[docs]</a>    <span class="k">def</span> <span class="nf">get_graph_id</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get graph_id</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+</div>
+<div class="viewcode-block" id="FitProblemComponent.set_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.set_result">[docs]</a>    <span class="k">def</span> <span class="nf">set_result</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+</div>
+<div class="viewcode-block" id="FitProblemComponent.get_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemComponent.get_result">[docs]</a>    <span class="k">def</span> <span class="nf">get_result</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get result</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+
+   </div></div>
+<div class="viewcode-block" id="FitProblemDictionary"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary">[docs]</a><span class="k">class</span> <span class="nc">FitProblemDictionary</span><span class="p">(</span><span class="n">FitProblemComponent</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    This module implements a dictionary of fitproblem objects</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="n">FitProblemComponent</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="nb">dict</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="c">## the current model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## if 1 this fit problem will be selected to fit , if 0</span>
+        <span class="c">## it will not be selected for fit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">schedule</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">##list containing parameter name and value</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## fitting range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_smear_on</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">scheduled</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_tab_caption</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nbr_residuals_computed</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_inputs</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_outputs</span> <span class="o">=</span> <span class="p">{}</span>
+ 
+<div class="viewcode-block" id="FitProblemDictionary.enable_smearing"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.enable_smearing">[docs]</a>    <span class="k">def</span> <span class="nf">enable_smearing</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :param flag: bool.When flag is 1 get the computer smear value. When</span>
+<span class="sd">        flag is 0 ingore smear value.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_smear_on</span> <span class="o">=</span> <span class="n">flag</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">itervalues</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">.</span><span class="n">enable_smearing</span><span class="p">(</span><span class="n">flag</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+                <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">enable_smearing</span><span class="p">(</span><span class="n">flag</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_smearer"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_smearer">[docs]</a>    <span class="k">def</span> <span class="nf">set_smearer</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">smearer</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save reference of  smear object on fitdata</span>
+<span class="sd">        :param smear: smear object from DataLoader</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">itervalues</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">.</span><span class="n">set_smearer</span><span class="p">(</span><span class="n">smearer</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+                <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">set_smearer</span><span class="p">(</span><span class="n">smearer</span><span class="p">)</span>
+                </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_smearer"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_smearer">[docs]</a>    <span class="k">def</span> <span class="nf">get_smearer</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return smear object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">get_smearer</span><span class="p">()</span>
+     </div>
+<div class="viewcode-block" id="FitProblemDictionary.save_model_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.save_model_name">[docs]</a>    <span class="k">def</span> <span class="nf">save_model_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">itervalues</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">.</span><span class="n">save_model_name</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+                <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">save_model_name</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+                </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">result</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">itervalues</span><span class="p">():</span>
+                <span class="n">result</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">get_name</span><span class="p">())</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+                <span class="n">result</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">get_name</span><span class="p">())</span>
+        <span class="k">return</span> <span class="n">result</span>
+    </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_model">[docs]</a>    <span class="k">def</span> <span class="nf">set_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        associates each model with its new created name</span>
+<span class="sd">        :param model: model selected</span>
+<span class="sd">        :param name: name created for model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">model</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">itervalues</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">.</span><span class="n">set_model</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+                <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">set_model</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+      </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_model">[docs]</a>    <span class="k">def</span> <span class="nf">get_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: saved model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">get_model</span><span class="p">()</span>
+       </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_fit_tab_caption"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_fit_tab_caption">[docs]</a>    <span class="k">def</span> <span class="nf">set_fit_tab_caption</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">caption</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        store the caption of the page associated with object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_tab_caption</span> <span class="o">=</span> <span class="n">caption</span>
+    </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_fit_tab_caption"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_fit_tab_caption">[docs]</a>    <span class="k">def</span> <span class="nf">get_fit_tab_caption</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return the caption of the page associated with object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_tab_caption</span>
+    </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_residuals"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_residuals">[docs]</a>    <span class="k">def</span> <span class="nf">set_residuals</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">residuals</span><span class="p">,</span> <span class="n">fid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save a copy of residual</span>
+<span class="sd">        :param data: data selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">set_residuals</span><span class="p">(</span><span class="n">residuals</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_residuals"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_residuals">[docs]</a>    <span class="k">def</span> <span class="nf">get_residuals</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: residuals</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">get_residuals</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_theory_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_theory_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_theory_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save a copy of the data select to fit</span>
+<span class="sd">        :param data: data selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">set_theory_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_theory_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_theory_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_theory_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: list of data dList</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">get_theory_data</span><span class="p">()</span>
+            </div>
+<div class="viewcode-block" id="FitProblemDictionary.add_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.add_data">[docs]</a>    <span class="k">def</span> <span class="nf">add_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Add data to the current dictionary of fitproblem. if data id does not</span>
+<span class="sd">        exist create a new fit problem.</span>
+<span class="sd">        :note: only data changes in the fit problem</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="bp">self</span><span class="p">[</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">]</span> <span class="o">=</span> <span class="n">FitProblem</span><span class="p">()</span>
+        <span class="bp">self</span><span class="p">[</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">]</span><span class="o">.</span><span class="n">set_fit_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_fit_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_fit_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_fit_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save a copy of the data select to fit</span>
+<span class="sd">        :param data: data selected</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">d</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">):</span>
+                <span class="k">if</span> <span class="p">(</span><span class="n">d</span><span class="o">.</span><span class="n">id</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">()):</span>
+                    <span class="bp">self</span><span class="p">[</span><span class="n">d</span><span class="o">.</span><span class="n">id</span><span class="p">]</span> <span class="o">=</span> <span class="n">FitProblem</span><span class="p">()</span>
+                <span class="bp">self</span><span class="p">[</span><span class="n">d</span><span class="o">.</span><span class="n">id</span><span class="p">]</span><span class="o">.</span><span class="n">set_fit_data</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>
+                <span class="bp">self</span><span class="p">[</span><span class="n">d</span><span class="o">.</span><span class="n">id</span><span class="p">]</span><span class="o">.</span><span class="n">set_model</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+                <span class="bp">self</span><span class="p">[</span><span class="n">d</span><span class="o">.</span><span class="n">id</span><span class="p">]</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+                </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_fit_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_fit_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_fit_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return data for the given fitproblem id</span>
+<span class="sd">        :param fid: is key representing a fitproblem. usually extract from data</span>
+<span class="sd">                    id</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">get_fit_data</span><span class="p">()</span>
+   </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_model_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_model_param">[docs]</a>    <span class="k">def</span> <span class="nf">set_model_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store the name and value of a parameter of this fitproblem&#39;s model</span>
+<span class="sd">        :param name: name of the given parameter</span>
+<span class="sd">        :param value: value of that parameter</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">itervalues</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">.</span><span class="n">set_model_param</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+                <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">set_model_param</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+                </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_model_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_model_param">[docs]</a>    <span class="k">def</span> <span class="nf">get_model_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return list of couple of parameter name and value</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">get_model_param</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_param2fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_param2fit">[docs]</a>    <span class="k">def</span> <span class="nf">set_param2fit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store param names to fit (checked)</span>
+<span class="sd">        :param list: list of the param names</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_param2fit</span> <span class="o">=</span> <span class="nb">list</span>
+        </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_param2fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_param2fit">[docs]</a>    <span class="k">def</span> <span class="nf">get_param2fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the list param names to fit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">list_param2fit</span>
+          </div>
+<div class="viewcode-block" id="FitProblemDictionary.schedule_tofit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.schedule_tofit">[docs]</a>    <span class="k">def</span> <span class="nf">schedule_tofit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schedule</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set schedule to true to decide if this fit  must be performed</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">scheduled</span> <span class="o">=</span> <span class="n">schedule</span>
+        <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">itervalues</span><span class="p">():</span>
+            <span class="n">value</span><span class="o">.</span><span class="n">schedule_tofit</span><span class="p">(</span><span class="n">schedule</span><span class="p">)</span>
+      </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_scheduled"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_scheduled">[docs]</a>    <span class="k">def</span> <span class="nf">get_scheduled</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return true or false if a problem as being schedule for fitting</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scheduled</span>
+    </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_range"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_range">[docs]</a>    <span class="k">def</span> <span class="nf">set_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">qmin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">qmax</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set fitting range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="n">qmin</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">itervalues</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+                <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_range"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_range">[docs]</a>    <span class="k">def</span> <span class="nf">get_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: fitting range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">get_range</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_weight"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_weight">[docs]</a>    <span class="k">def</span> <span class="nf">set_weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">is2d</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fit weight</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">itervalues</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">.</span><span class="n">set_weight</span><span class="p">(</span><span class="n">flag</span><span class="o">=</span><span class="n">flag</span><span class="p">,</span> <span class="n">is2d</span><span class="o">=</span><span class="n">is2d</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+                <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">set_weight</span><span class="p">(</span><span class="n">flag</span><span class="o">=</span><span class="n">flag</span><span class="p">,</span> <span class="n">is2d</span><span class="o">=</span><span class="n">is2d</span><span class="p">)</span>
+                </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_weight"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_weight">[docs]</a>    <span class="k">def</span> <span class="nf">get_weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return fit weight</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">get_weight</span><span class="p">()</span>
+                 </div>
+<div class="viewcode-block" id="FitProblemDictionary.clear_model_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.clear_model_param">[docs]</a>    <span class="k">def</span> <span class="nf">clear_model_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        clear constraint info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">itervalues</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">.</span><span class="n">clear_model_param</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+                <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">clear_model_param</span><span class="p">()</span>
+                </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_fit_problem"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_fit_problem">[docs]</a>    <span class="k">def</span> <span class="nf">get_fit_problem</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return fitproblem contained in this dictionary</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">itervalues</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_result">[docs]</a>    <span class="k">def</span> <span class="nf">set_result</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="n">fid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">set_result</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_batch_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_batch_result">[docs]</a>    <span class="k">def</span> <span class="nf">set_batch_result</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">batch_inputs</span><span class="p">,</span> <span class="n">batch_outputs</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set a list of result</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_inputs</span> <span class="o">=</span> <span class="n">batch_inputs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_outputs</span> <span class="o">=</span> <span class="n">batch_outputs</span>
+             </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_result">[docs]</a>    <span class="k">def</span> <span class="nf">get_result</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get result</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">fid</span><span class="p">]</span><span class="o">.</span><span class="n">get_result</span><span class="p">()</span>
+            </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_batch_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_batch_result">[docs]</a>    <span class="k">def</span> <span class="nf">get_batch_result</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get result</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_inputs</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_outputs</span>
+    </div>
+<div class="viewcode-block" id="FitProblemDictionary.set_graph_id"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.set_graph_id">[docs]</a>    <span class="k">def</span> <span class="nf">set_graph_id</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set graph id (from data_group_id at the time the graph produced) </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span> <span class="o">=</span> <span class="nb">id</span>
+        </div>
+<div class="viewcode-block" id="FitProblemDictionary.get_graph_id"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblemDictionary.get_graph_id">[docs]</a>    <span class="k">def</span> <span class="nf">get_graph_id</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get graph_id</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span>
+    
+    </div></div>
+<div class="viewcode-block" id="FitProblem"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem">[docs]</a><span class="k">class</span> <span class="nc">FitProblem</span><span class="p">(</span><span class="n">FitProblemComponent</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    FitProblem class allows to link a model with the new name created in _on_model,</span>
+<span class="sd">    a name theory created with that model  and the data fitted with the model.</span>
+<span class="sd">    FitProblem is mostly used  as value of the dictionary by fitting module.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="n">FitProblemComponent</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        contains information about data and model to fit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## data used for fitting</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">theory_data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">residuals</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># original data: should not be modified</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">original_data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## the current model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## if 1 this fit problem will be selected to fit , if 0</span>
+        <span class="c">## it will not be selected for fit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">schedule</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">##list containing parameter name and value</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## smear object to smear or not data1D</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer_computed</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer_enable</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer_computer_value</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## fitting range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># fit weight</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weight</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">result</span> <span class="o">=</span> <span class="bp">None</span>
+        
+<div class="viewcode-block" id="FitProblem.enable_smearing"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.enable_smearing">[docs]</a>    <span class="k">def</span> <span class="nf">enable_smearing</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :param flag: bool.When flag is 1 get the computer smear value. When</span>
+<span class="sd">        flag is 0 ingore smear value.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer_enable</span> <span class="o">=</span> <span class="n">flag</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.set_smearer"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_smearer">[docs]</a>    <span class="k">def</span> <span class="nf">set_smearer</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">smearer</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save reference of  smear object on fitdata</span>
+<span class="sd">        </span>
+<span class="sd">        :param smear: smear object from DataLoader</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer_computer_value</span> <span class="o">=</span> <span class="n">smearer</span>
+       </div>
+<div class="viewcode-block" id="FitProblem.get_smearer"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_smearer">[docs]</a>    <span class="k">def</span> <span class="nf">get_smearer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return smear object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">smearer_enable</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">smearer_computed</span><span class="p">:</span>
+            <span class="c">#smeari_selection should be call only once per fitproblem</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smearer_computer_value</span> <span class="o">=</span> <span class="n">smear_selection</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_data</span><span class="p">,</span>
+                                                           <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">smearer_computed</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">smearer_computer_value</span>
+    </div>
+<div class="viewcode-block" id="FitProblem.save_model_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.save_model_name">[docs]</a>    <span class="k">def</span> <span class="nf">save_model_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name_per_page</span> <span class="o">=</span> <span class="n">name</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.get_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_name">[docs]</a>    <span class="k">def</span> <span class="nf">get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name_per_page</span>
+    </div>
+<div class="viewcode-block" id="FitProblem.set_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_model">[docs]</a>    <span class="k">def</span> <span class="nf">set_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        associates each model with its new created name</span>
+<span class="sd">        :param model: model selected</span>
+<span class="sd">        :param name: name created for model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer_computer_value</span> <span class="o">=</span> <span class="n">smear_selection</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_data</span><span class="p">,</span>
+                                                           <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer_computed</span> <span class="o">=</span> <span class="bp">True</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.get_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_model">[docs]</a>    <span class="k">def</span> <span class="nf">get_model</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: saved model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span>
+   </div>
+<div class="viewcode-block" id="FitProblem.set_residuals"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_residuals">[docs]</a>    <span class="k">def</span> <span class="nf">set_residuals</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">residuals</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save a copy of residual</span>
+<span class="sd">        :param data: data selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">residuals</span> <span class="o">=</span> <span class="n">residuals</span>
+            </div>
+<div class="viewcode-block" id="FitProblem.get_residuals"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_residuals">[docs]</a>    <span class="k">def</span> <span class="nf">get_residuals</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: residuals</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">residuals</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.set_theory_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_theory_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_theory_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save a copy of the data select to fit</span>
+<span class="sd">        </span>
+<span class="sd">        :param data: data selected</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">theory_data</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">data</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.get_theory_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_theory_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_theory_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: theory generated with the current model and data of this class</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">theory_data</span>
+</div>
+<div class="viewcode-block" id="FitProblem.set_fit_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_fit_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_fit_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store data associated with this class</span>
+<span class="sd">        :param data: list of data selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">original_data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># original data: should not be modified</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">original_data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="c"># fit data: used for fit and can be modified for convenience</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_data</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">data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer_computer_value</span> <span class="o">=</span> <span class="n">smear_selection</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_data</span><span class="p">,</span>
+                                                           <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer_computed</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">result</span> <span class="o">=</span> <span class="bp">None</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.get_fit_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_fit_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_fit_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: data associate with this class</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_data</span>
+    </div>
+<div class="viewcode-block" id="FitProblem.get_origin_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_origin_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_origin_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">original_data</span>
+    </div>
+<div class="viewcode-block" id="FitProblem.set_weight"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_weight">[docs]</a>    <span class="k">def</span> <span class="nf">set_weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">is2d</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Received flag and compute error on data.</span>
+<span class="sd">        :param flag: flag to transform error of data.</span>
+<span class="sd">        :param is2d: flag to distinguish 1D to 2D Data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">sas.perspectives.fitting.utils</span> <span class="kn">import</span> <span class="n">get_weight</span>
+        <span class="c"># send original data for weighting</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weight</span> <span class="o">=</span> <span class="n">get_weight</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">original_data</span><span class="p">,</span> <span class="n">is2d</span><span class="o">=</span><span class="n">is2d</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">flag</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">is2d</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_data</span><span class="o">.</span><span class="n">err_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_data</span><span class="o">.</span><span class="n">dy</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight</span>
+</div>
+<div class="viewcode-block" id="FitProblem.get_weight"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_weight">[docs]</a>    <span class="k">def</span> <span class="nf">get_weight</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        returns weight array</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">weight</span>
+    </div>
+<div class="viewcode-block" id="FitProblem.set_param2fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_param2fit">[docs]</a>    <span class="k">def</span> <span class="nf">set_param2fit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store param names to fit (checked)</span>
+<span class="sd">        :param list: list of the param names</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_param2fit</span> <span class="o">=</span> <span class="nb">list</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.get_param2fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_param2fit">[docs]</a>    <span class="k">def</span> <span class="nf">get_param2fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the list param names to fit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">list_param2fit</span>
+    </div>
+<div class="viewcode-block" id="FitProblem.set_model_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_model_param">[docs]</a>    <span class="k">def</span> <span class="nf">set_model_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store the name and value of a parameter of this fitproblem&#39;s model</span>
+<span class="sd">        :param name: name of the given parameter</span>
+<span class="sd">        :param value: value of that parameter</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_param</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">])</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.get_model_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_model_param">[docs]</a>    <span class="k">def</span> <span class="nf">get_model_param</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return list of couple of parameter name and value</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">list_param</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.schedule_tofit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.schedule_tofit">[docs]</a>    <span class="k">def</span> <span class="nf">schedule_tofit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schedule</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set schedule to true to decide if this fit  must be performed</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">schedule</span> <span class="o">=</span> <span class="n">schedule</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.get_scheduled"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_scheduled">[docs]</a>    <span class="k">def</span> <span class="nf">get_scheduled</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return true or false if a problem as being schedule for fitting</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">schedule</span>
+    </div>
+<div class="viewcode-block" id="FitProblem.set_range"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_range">[docs]</a>    <span class="k">def</span> <span class="nf">set_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">qmin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">qmax</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set fitting range</span>
+<span class="sd">        :param qmin: minimum value to consider for the fit range</span>
+<span class="sd">        :param qmax: maximum value to consider for the fit range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="n">qmin</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="n">qmax</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.get_range"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_range">[docs]</a>    <span class="k">def</span> <span class="nf">get_range</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :return: fitting range</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span>
+    </div>
+<div class="viewcode-block" id="FitProblem.clear_model_param"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.clear_model_param">[docs]</a>    <span class="k">def</span> <span class="nf">clear_model_param</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        clear constraint info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_param</span> <span class="o">=</span> <span class="p">[]</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.set_fit_tab_caption"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_fit_tab_caption">[docs]</a>    <span class="k">def</span> <span class="nf">set_fit_tab_caption</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">caption</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_tab_caption</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">caption</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.get_fit_tab_caption"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_fit_tab_caption">[docs]</a>    <span class="k">def</span> <span class="nf">get_fit_tab_caption</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_tab_caption</span>
+    </div>
+<div class="viewcode-block" id="FitProblem.set_graph_id"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_graph_id">[docs]</a>    <span class="k">def</span> <span class="nf">set_graph_id</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set graph id (from data_group_id at the time the graph produced)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span> <span class="o">=</span> <span class="nb">id</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.get_graph_id"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_graph_id">[docs]</a>    <span class="k">def</span> <span class="nf">get_graph_id</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get graph_id</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">graph_id</span>
+    </div>
+<div class="viewcode-block" id="FitProblem.set_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.set_result">[docs]</a>    <span class="k">def</span> <span class="nf">set_result</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">result</span> <span class="o">=</span> <span class="n">result</span>
+        </div>
+<div class="viewcode-block" id="FitProblem.get_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitproblem.FitProblem.get_result">[docs]</a>    <span class="k">def</span> <span class="nf">get_result</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get result</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">result</span></div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/fitting.html
===================================================================
--- _modules/sas/perspectives/fitting/fitting.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/fitting.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,2303 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.fitting &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.fitting</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Fitting perspective</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation.</span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+<span class="kn">import</span> <span class="nn">re</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">logging</span>
+<span class="kn">import</span> <span class="nn">numpy</span>
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">deepcopy</span>
+<span class="kn">import</span> <span class="nn">models</span>
+
+<span class="kn">from</span> <span class="nn">sas.dataloader.loader</span> <span class="kn">import</span> <span class="n">Loader</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">Data2D</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">Data1D</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">check_data_validity</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">NewPlotEvent</span> 
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>  
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">EVT_SLICER_PANEL</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">EVT_SLICER_PARS_UPDATE</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.gui_style</span> <span class="kn">import</span> <span class="n">GUIFRAME_ID</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.plugin_base</span> <span class="kn">import</span> <span class="n">PluginBase</span> 
+<span class="kn">from</span> <span class="nn">sas.guiframe.data_processor</span> <span class="kn">import</span> <span class="n">BatchCell</span>
+<span class="kn">from</span> <span class="nn">sas.fit.Fitting</span> <span class="kn">import</span> <span class="n">Fit</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.console</span> <span class="kn">import</span> <span class="n">ConsoleUpdate</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.fitproblem</span> <span class="kn">import</span> <span class="n">FitProblemDictionary</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.fitpanel</span> <span class="kn">import</span> <span class="n">FitPanel</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.resultpanel</span> <span class="kn">import</span> <span class="n">ResultPanel</span><span class="p">,</span> <span class="n">PlotResultEvent</span>
+
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.fit_thread</span> <span class="kn">import</span> <span class="n">FitThread</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.pagestate</span> <span class="kn">import</span> <span class="n">Reader</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.fitting.fitpage</span> <span class="kn">import</span> <span class="n">Chi2UpdateEvent</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.model_editor</span> <span class="kn">import</span> <span class="n">TextDialog</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.calculator.model_editor</span> <span class="kn">import</span> <span class="n">EditorWindow</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.gui_manager</span> <span class="kn">import</span> <span class="n">MDIFrame</span>
+
+<span class="c"># TODO: remove globals from interface to bumps options!</span>
+<span class="c"># Default bumps to use the levenberg-marquardt optimizer</span>
+<span class="kn">import</span> <span class="nn">bumps.fitters</span>
+<span class="n">bumps</span><span class="o">.</span><span class="n">fitters</span><span class="o">.</span><span class="n">FIT_DEFAULT</span> <span class="o">=</span> <span class="s">&#39;lm&#39;</span>
+
+<span class="n">MAX_NBR_DATA</span> <span class="o">=</span> <span class="mi">4</span>
+<span class="n">SAS_F_TOL</span> <span class="o">=</span> <span class="mf">5e-05</span>
+
+<span class="p">(</span><span class="n">PageInfoEvent</span><span class="p">,</span> <span class="n">EVT_PAGE_INFO</span><span class="p">)</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">newevent</span><span class="o">.</span><span class="n">NewEvent</span><span class="p">()</span>
+
+
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span> <span class="o">==</span> <span class="s">&quot;win32&quot;</span><span class="p">:</span>
+    <span class="n">ON_MAC</span> <span class="o">=</span> <span class="bp">False</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">ON_MAC</span> <span class="o">=</span> <span class="bp">True</span>
+
+
+
+<div class="viewcode-block" id="Plugin"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin">[docs]</a><span class="k">class</span> <span class="nc">Plugin</span><span class="p">(</span><span class="n">PluginBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Fitting plugin is used to perform fit</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">standalone</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="n">PluginBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&quot;Fitting&quot;</span><span class="p">,</span> <span class="n">standalone</span><span class="o">=</span><span class="n">standalone</span><span class="p">)</span>
+        
+        <span class="c">#list of panel to send to guiframe</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mypanels</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># reference to the current running thread</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">calc_2D</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">calc_1D</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">color_dict</span> <span class="o">=</span> <span class="p">{}</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_thread_list</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">residuals</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weight</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot_panel</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># Start with a good default</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">elapsed</span> <span class="o">=</span> <span class="mf">0.022</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#Flag to let the plug-in know that it is running stand alone</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">standalone</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c">## dictionary of page closed and id</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">closed_page_dict</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c">## Fit engine</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span> <span class="o">=</span> <span class="s">&#39;bumps&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_gui_engine</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## Relative error desired in the sum of squares (float); scipy only</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">ftol</span> <span class="o">=</span> <span class="n">SAS_F_TOL</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_reset_flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c">#List of selected data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">selected_data_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## list of slicer panel created to display slicer parameters and results</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slicer_panels</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># model 2D view</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model2D_id</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#keep reference of the simultaneous fit page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sim_menu</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_menu</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">index_model</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">test_model_color</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#Create a reader for fit page&#39;s state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_reader</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_extensions</span> <span class="o">=</span> <span class="s">&#39;.fitv&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">scipy_id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">park_id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bumps_id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">new_model_frame</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_index</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sfile_ext</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># take care of saving  data, model and page associated with each other</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c"># Log startup</span>
+        <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Fitting plug-in started&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_capable</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_batch_capable</span><span class="p">()</span>
+    
+<div class="viewcode-block" id="Plugin.get_batch_capable"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.get_batch_capable">[docs]</a>    <span class="k">def</span> <span class="nf">get_batch_capable</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check if the plugin has a batch capability</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">True</span>
+    </div>
+<div class="viewcode-block" id="Plugin.create_fit_problem"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.create_fit_problem">[docs]</a>    <span class="k">def</span> <span class="nf">create_fit_problem</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">page_id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Given an ID create a fitproblem container</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span> <span class="o">=</span> <span class="n">FitProblemDictionary</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="Plugin.delete_fit_problem"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.delete_fit_problem">[docs]</a>    <span class="k">def</span> <span class="nf">delete_fit_problem</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">page_id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Given an ID create a fitproblem container</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">page_id</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span>
+        </div>
+<div class="viewcode-block" id="Plugin.add_color"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.add_color">[docs]</a>    <span class="k">def</span> <span class="nf">add_color</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">color</span><span class="p">,</span> <span class="nb">id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        adds a color as a key with a plot id as its value to a dictionary</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">color_dict</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span> <span class="o">=</span> <span class="n">color</span>
+        </div>
+<div class="viewcode-block" id="Plugin.on_batch_selection"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.on_batch_selection">[docs]</a>    <span class="k">def</span> <span class="nf">on_batch_selection</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">flag</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        switch the the notebook of batch mode or not</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span> <span class="o">=</span> <span class="n">flag</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">batch_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span>
+        </div>
+<div class="viewcode-block" id="Plugin.populate_menu"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.populate_menu">[docs]</a>    <span class="k">def</span> <span class="nf">populate_menu</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">owner</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create a menu for the Fitting plug-in</span>
+<span class="sd">        </span>
+<span class="sd">        :param id: id to create a menu</span>
+<span class="sd">        :param owner: owner of menu</span>
+<span class="sd">        </span>
+<span class="sd">        :return: list of information to populate the main menu</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Menu for fitting</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="n">id1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">simul_help</span> <span class="o">=</span> <span class="s">&quot;Add new fit panel&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">id1</span><span class="p">,</span> <span class="s">&#39;&amp;New Fit Page&#39;</span><span class="p">,</span> <span class="n">simul_help</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">owner</span><span class="p">,</span> <span class="n">id1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_add_new_page</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">AppendSeparator</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">id_simfit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">simul_help</span> <span class="o">=</span> <span class="s">&quot;Constrained or Simultaneous Fit&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_simfit</span><span class="p">,</span> <span class="s">&#39;&amp;Constrained or Simultaneous Fit&#39;</span><span class="p">,</span> <span class="n">simul_help</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">owner</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">id_simfit</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_add_sim_page</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sim_menu</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_simfit</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sim_menu</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="c">#combined Batch</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">id_batchfit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">batch_help</span> <span class="o">=</span> <span class="s">&quot;Combined Batch&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_batchfit</span><span class="p">,</span> <span class="s">&#39;&amp;Combine Batch Fit&#39;</span><span class="p">,</span> <span class="n">batch_help</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">owner</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">id_batchfit</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_add_sim_page</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_menu</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_batchfit</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_menu</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">AppendSeparator</span><span class="p">()</span>
+        <span class="c">#Set park engine</span>
+        <span class="n">scipy_help</span> <span class="o">=</span> <span class="s">&quot;Scipy Engine: Perform Simple fit. More in Help window....&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">AppendCheckItem</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">scipy_id</span><span class="p">,</span> <span class="s">&quot;Simple FitEngine [LeastSq]&quot;</span><span class="p">,</span>
+                                   <span class="n">scipy_help</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">owner</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">scipy_id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onset_engine_scipy</span><span class="p">)</span>
+        
+        <span class="n">park_help</span> <span class="o">=</span> <span class="s">&quot;Park Engine: Perform Complex fit. More in Help window....&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">AppendCheckItem</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">park_id</span><span class="p">,</span> <span class="s">&quot;Complex FitEngine [ParkMC]&quot;</span><span class="p">,</span>
+                                   <span class="n">park_help</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">owner</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">park_id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onset_engine_park</span><span class="p">)</span>
+        
+        <span class="n">bumps_help</span> <span class="o">=</span> <span class="s">&quot;Bumps: fitting and uncertainty analysis. More in Help window....&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">AppendCheckItem</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bumps_id</span><span class="p">,</span> <span class="s">&quot;Bumps fit&quot;</span><span class="p">,</span>
+                                   <span class="n">bumps_help</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">owner</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">bumps_id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onset_engine_bumps</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">scipy_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span><span class="o">==</span><span class="s">&quot;scipy&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">park_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span><span class="o">==</span><span class="s">&quot;park&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bumps_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span><span class="o">==</span><span class="s">&quot;bumps&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">AppendSeparator</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">id_tol</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">ftol_help</span> <span class="o">=</span> <span class="s">&quot;Change the current FTolerance (=</span><span class="si">%s</span><span class="s">) &quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ftol</span><span class="p">)</span>
+        <span class="n">ftol_help</span> <span class="o">+=</span> <span class="s">&quot;of Simple FitEngine...&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_tol</span><span class="p">,</span> <span class="s">&quot;Change FTolerance&quot;</span><span class="p">,</span>
+                                   <span class="n">ftol_help</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">owner</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">id_tol</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">show_ftol_dialog</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">id_bumps_options</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">bopts_help</span> <span class="o">=</span> <span class="s">&quot;Bumps fitting options&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_bumps_options</span><span class="p">,</span> <span class="s">&#39;Bumps &amp;Options&#39;</span><span class="p">,</span> <span class="n">bopts_help</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">owner</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">id_bumps_options</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_bumps_options</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bumps_options_menu</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_bumps_options</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bumps_options_menu</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">id_result_panel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_result_panel</span><span class="p">,</span> <span class="s">&quot;Fit Results&quot;</span><span class="p">,</span> <span class="s">&quot;Show fit results panel&quot;</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">owner</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">id_result_panel</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">ev</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">result_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">AppendSeparator</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">id_reset_flag</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">resetf_help</span> <span class="o">=</span> <span class="s">&quot;BatchFit: If checked, the initial param values will be &quot;</span>
+        <span class="n">resetf_help</span> <span class="o">+=</span> <span class="s">&quot;propagated from the previous results. &quot;</span>
+        <span class="n">resetf_help</span> <span class="o">+=</span> <span class="s">&quot;Otherwise, the same initial param values will be used &quot;</span>
+        <span class="n">resetf_help</span> <span class="o">+=</span> <span class="s">&quot;for all fittings.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">AppendCheckItem</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_reset_flag</span><span class="p">,</span>
+                                   <span class="s">&quot;Chain Fitting [BatchFit Only]&quot;</span><span class="p">,</span>
+                                   <span class="n">resetf_help</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">owner</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">id_reset_flag</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_reset_batch_flag</span><span class="p">)</span>
+        <span class="n">chain_menu</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_reset_flag</span><span class="p">)</span>
+        <span class="n">chain_menu</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_reset_flag</span><span class="p">)</span>
+        <span class="n">chain_menu</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">AppendSeparator</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">edit_model_menu</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="c"># Find and put files name in menu</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_edit_menu</span><span class="p">(</span><span class="n">owner</span><span class="o">=</span><span class="n">owner</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">raise</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">id_edit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">editmodel_help</span> <span class="o">=</span> <span class="s">&quot;Edit customized model sample file&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">AppendMenu</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_edit</span><span class="p">,</span> <span class="s">&quot;Edit Custom Model&quot;</span><span class="p">,</span>
+                              <span class="bp">self</span><span class="o">.</span><span class="n">edit_model_menu</span><span class="p">,</span> <span class="n">editmodel_help</span><span class="p">)</span>
+        <span class="c">#create  menubar items</span>
+        <span class="k">return</span> <span class="p">[(</span><span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">sub_menu</span><span class="p">)]</span>
+    </div>
+<div class="viewcode-block" id="Plugin.edit_custom_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.edit_custom_model">[docs]</a>    <span class="k">def</span> <span class="nf">edit_custom_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the python editor panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">()</span>
+        <span class="n">label</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">edit_menu</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span>
+        <span class="kn">from</span> <span class="nn">sas.perspectives.calculator.pyconsole</span> <span class="kn">import</span> <span class="n">PyConsole</span>
+        <span class="n">filename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">find_plugins_dir</span><span class="p">(),</span> <span class="n">label</span><span class="p">)</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">PyConsole</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span>
+                          <span class="n">panel</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="p">,</span>
+                          <span class="n">title</span><span class="o">=</span><span class="s">&#39;Advanced Custom Model Editor&#39;</span><span class="p">,</span>
+                          <span class="n">filename</span><span class="o">=</span><span class="n">filename</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+        <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="Plugin.delete_custom_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.delete_custom_model">[docs]</a>    <span class="k">def</span> <span class="nf">delete_custom_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Delete custom model file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">()</span>
+        <span class="n">label</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">delete_menu</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span>
+        <span class="n">toks</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">label</span><span class="p">)</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">find_plugins_dir</span><span class="p">(),</span> <span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">ext</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;.py&#39;</span><span class="p">,</span> <span class="s">&#39;.pyc&#39;</span><span class="p">]:</span>
+                <span class="n">p_path</span> <span class="o">=</span> <span class="n">path</span> <span class="o">+</span> <span class="n">ext</span>
+                <span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">p_path</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">update_custom_combo</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">p_path</span><span class="p">):</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Sorry! Could not be able to delete the default &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;custom model... </span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Please manually remove the files (.py, .pyc) &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;in the &#39;plugin_models&#39; folder </span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;inside of the SasView application, &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;and try it again.&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Info&#39;</span><span class="p">)</span>
+                <span class="c">#wx.PostEvent(self.parent, StatusEvent(status=msg, type=&#39;stop&#39;,</span>
+                <span class="c">#                                      info=&#39;warning&#39;))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">delete_menu</span><span class="o">.</span><span class="n">Delete</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">edit_menu</span><span class="o">.</span><span class="n">GetMenuItems</span><span class="p">():</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span> <span class="o">==</span> <span class="n">label</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">edit_menu</span><span class="o">.</span><span class="n">DeleteItem</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;The custom model, </span><span class="si">%s</span><span class="s">, has been deleted.&quot;</span><span class="o">%</span> <span class="n">label</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> 
+                                                <span class="nb">type</span><span class="o">=</span><span class="s">&#39;stop&#39;</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;info&#39;</span><span class="p">))</span>
+                        <span class="k">break</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span><span class="s">&#39;Delete Error: </span><span class="se">\n</span><span class="s">Could not delete the file; Check if in use.&#39;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">MessageBox</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="s">&#39;Error&#39;</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="Plugin.make_sum_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.make_sum_model">[docs]</a>    <span class="k">def</span> <span class="nf">make_sum_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Edit summodel template and make one</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">()</span>
+        <span class="n">model_manager</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">ModelManager</span><span class="p">()</span>
+        <span class="n">model_list</span> <span class="o">=</span> <span class="n">model_manager</span><span class="o">.</span><span class="n">get_model_name_list</span><span class="p">()</span>
+        <span class="n">plug_dir</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">find_plugins_dir</span><span class="p">()</span>
+        <span class="n">textdial</span> <span class="o">=</span> <span class="n">TextDialog</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Easy Sum/Multi(p1, p2) Editor&#39;</span><span class="p">,</span> 
+                              <span class="n">model_list</span><span class="p">,</span> <span class="n">plug_dir</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="n">textdial</span><span class="p">)</span>
+        <span class="n">textdial</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        <span class="n">textdial</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="Plugin.make_new_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.make_new_model">[docs]</a>    <span class="k">def</span> <span class="nf">make_new_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Make new model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">new_model_frame</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">new_model_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">new_model_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="nb">id</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">()</span>
+            <span class="n">dir_path</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">find_plugins_dir</span><span class="p">()</span>
+            <span class="n">title</span> <span class="o">=</span> <span class="s">&quot;New Custom Model Function&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">new_model_frame</span> <span class="o">=</span> <span class="n">EditorWindow</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span>
+                                                <span class="n">path</span><span class="o">=</span><span class="n">dir_path</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">put_icon</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">new_model_frame</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">new_model_frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="Plugin.update_custom_combo"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.update_custom_combo">[docs]</a>    <span class="k">def</span> <span class="nf">update_custom_combo</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Update custom model list in the fitpage combo box</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">custom_model</span> <span class="o">=</span> <span class="s">&#39;Customized Models&#39;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># Update edit menus</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_edit_menu_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">edit_custom_model</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">set_edit_menu_helper</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">delete_custom_model</span><span class="p">)</span>
+            <span class="n">temp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">reset_pmodel_list</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">temp</span><span class="p">:</span>
+                <span class="c"># Set the new custom model list for all fit pages</span>
+                <span class="k">for</span> <span class="n">uid</span><span class="p">,</span> <span class="n">page</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">opened_pages</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                    <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">page</span><span class="p">,</span> <span class="s">&quot;formfactorbox&quot;</span><span class="p">):</span>
+                        <span class="n">page</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="n">temp</span>
+                        <span class="n">current_val</span> <span class="o">=</span> <span class="n">page</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+                        <span class="c">#if page.plugin_rbutton.GetValue():</span>
+                        <span class="n">mod_cat</span> <span class="o">=</span> <span class="n">page</span><span class="o">.</span><span class="n">categorybox</span><span class="o">.</span><span class="n">GetStringSelection</span><span class="p">()</span>
+                        <span class="k">if</span> <span class="n">mod_cat</span> <span class="o">==</span> <span class="n">custom_model</span><span class="p">:</span>
+                            <span class="c">#pos = page.formfactorbox.GetSelection()</span>
+                            <span class="n">page</span><span class="o">.</span><span class="n">_show_combox_helper</span><span class="p">()</span>
+                            <span class="n">new_val</span> <span class="o">=</span> <span class="n">page</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+                            <span class="k">if</span> <span class="n">current_val</span> <span class="o">!=</span> <span class="n">new_val</span> <span class="ow">and</span> <span class="n">new_val</span> <span class="o">!=</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                                <span class="n">page</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">new_val</span><span class="p">)</span>
+                            <span class="k">else</span><span class="p">:</span>
+                                <span class="n">page</span><span class="o">.</span><span class="n">formfactorbox</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">current_val</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+        
+        </div>
+<div class="viewcode-block" id="Plugin.set_edit_menu"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_edit_menu">[docs]</a>    <span class="k">def</span> <span class="nf">set_edit_menu</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">owner</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set list of the edit model menu labels</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="c">#new_model_menu = wx.Menu()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">edit_model_menu</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="s">&#39;New&#39;</span><span class="p">,</span>
+                                   <span class="s">&#39;Add a new model function&#39;</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">owner</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">make_new_model</span><span class="p">)</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">edit_model_menu</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="s">&#39;Sum|Multi(p1, p2)&#39;</span><span class="p">,</span>
+                                    <span class="s">&#39;Sum of two model functions&#39;</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">owner</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">make_sum_model</span><span class="p">)</span>
+        <span class="n">e_id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">edit_menu</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">edit_model_menu</span><span class="o">.</span><span class="n">AppendMenu</span><span class="p">(</span><span class="n">e_id</span><span class="p">,</span> 
+                                    <span class="s">&#39;Advanced&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">edit_menu</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_edit_menu_helper</span><span class="p">(</span><span class="n">owner</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">edit_custom_model</span><span class="p">)</span>
+
+        <span class="n">d_id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">delete_menu</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">edit_model_menu</span><span class="o">.</span><span class="n">AppendMenu</span><span class="p">(</span><span class="n">d_id</span><span class="p">,</span>
+                                        <span class="s">&#39;Delete&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">delete_menu</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_edit_menu_helper</span><span class="p">(</span><span class="n">owner</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">delete_custom_model</span><span class="p">)</span>
+    </div>
+<div class="viewcode-block" id="Plugin.set_edit_menu_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_edit_menu_helper">[docs]</a>    <span class="k">def</span> <span class="nf">set_edit_menu_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">owner</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">menu</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        help for setting list of the edit model menu labels</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">menu</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">menu</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">edit_custom_model</span>
+        <span class="n">list_fnames</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">find_plugins_dir</span><span class="p">())</span>
+        <span class="n">list_fnames</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">f_item</span> <span class="ow">in</span> <span class="n">list_fnames</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">f_item</span><span class="p">)</span>
+            <span class="n">toks</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">toks</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;.py&#39;</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;__init__&#39;</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">menu</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">edit_custom_model</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;easy_sum_of_p1_p2&#39;</span><span class="p">:</span>
+                        <span class="k">continue</span>
+                    <span class="n">submenu</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">edit_menu</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">submenu</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">delete_menu</span>
+                <span class="n">has_file</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">submenu</span><span class="o">.</span><span class="n">GetMenuItems</span><span class="p">():</span>
+                    <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="n">submenu</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">GetId</span><span class="p">()):</span>
+                        <span class="n">has_file</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">has_file</span><span class="p">:</span>
+                    <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+                    <span class="n">submenu</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">name</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">owner</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">menu</span><span class="p">)</span>
+                    <span class="n">has_file</span> <span class="o">=</span> <span class="bp">False</span>
+</div>
+<div class="viewcode-block" id="Plugin.put_icon"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.put_icon">[docs]</a>    <span class="k">def</span> <span class="nf">put_icon</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">frame</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Put icon in the frame title bar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">frame</span><span class="p">,</span> <span class="s">&quot;IsIconized&quot;</span><span class="p">):</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">frame</span><span class="o">.</span><span class="n">IsIconized</span><span class="p">():</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">icon</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">GetIcon</span><span class="p">()</span>
+                    <span class="n">frame</span><span class="o">.</span><span class="n">SetIcon</span><span class="p">(</span><span class="n">icon</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>
+</div>
+<div class="viewcode-block" id="Plugin.on_add_sim_page"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.on_add_sim_page">[docs]</a>    <span class="k">def</span> <span class="nf">on_add_sim_page</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create a page to access simultaneous fit option</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">()</span>
+        <span class="n">caption</span> <span class="o">=</span> <span class="s">&quot;Const &amp; Simul Fit&quot;</span>
+        <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span>
+        <span class="k">if</span> <span class="nb">id</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">id_batchfit</span><span class="p">:</span>
+            <span class="n">caption</span> <span class="o">=</span> <span class="s">&quot;Combined Batch&quot;</span>
+            <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span>
+            
+        <span class="k">def</span> <span class="nf">set_focus_page</span><span class="p">(</span><span class="n">page</span><span class="p">):</span>
+            <span class="n">page</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">page</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            <span class="n">page</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+            <span class="c">#self.parent._mgr.Update()</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> already opened</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">page</span><span class="o">.</span><span class="n">window_caption</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+            
+        <span class="k">if</span> <span class="n">page</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">set_focus_page</span><span class="p">(</span><span class="n">page</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">caption</span> <span class="o">==</span> <span class="s">&quot;Const &amp; Simul Fit&quot;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">add_sim_page</span><span class="p">(</span><span class="n">caption</span><span class="o">=</span><span class="n">caption</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">add_sim_page</span><span class="p">(</span><span class="n">caption</span><span class="o">=</span><span class="n">caption</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Plugin.help"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.help">[docs]</a>    <span class="k">def</span> <span class="nf">help</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show a general help dialog.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">help_panel</span> <span class="kn">import</span>  <span class="n">HelpWindow</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">HelpWindow</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;HelpWindow&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">frame</span><span class="p">,</span> <span class="s">&quot;IsIconized&quot;</span><span class="p">):</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">frame</span><span class="o">.</span><span class="n">IsIconized</span><span class="p">():</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">icon</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">GetIcon</span><span class="p">()</span>
+                    <span class="n">frame</span><span class="o">.</span><span class="n">SetIcon</span><span class="p">(</span><span class="n">icon</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>
+        <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Plugin.get_context_menu"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.get_context_menu">[docs]</a>    <span class="k">def</span> <span class="nf">get_context_menu</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">plotpanel</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the context menu items available for P(r).them allow fitting option</span>
+<span class="sd">        for Data2D and Data1D only.</span>
+<span class="sd">        </span>
+<span class="sd">        :param graph: the Graph object to which we attach the context menu</span>
+<span class="sd">        </span>
+<span class="sd">        :return: a list of menu items with call-back function</span>
+<span class="sd">        </span>
+<span class="sd">        :note: if Data1D was generated from Theory1D</span>
+<span class="sd">                the fitting option is not allowed</span>
+<span class="sd">                </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot_panel</span> <span class="o">=</span> <span class="n">plotpanel</span>
+        <span class="n">graph</span> <span class="o">=</span> <span class="n">plotpanel</span><span class="o">.</span><span class="n">graph</span>
+        <span class="n">fit_option</span> <span class="o">=</span> <span class="s">&quot;Select data for fitting&quot;</span>
+        <span class="n">fit_hint</span> <span class="o">=</span>  <span class="s">&quot;Dialog with fitting parameters &quot;</span>
+        
+        <span class="k">if</span> <span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">plotpanel</span><span class="o">.</span><span class="n">plots</span><span class="p">:</span>
+            <span class="k">return</span> <span class="p">[]</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">plotpanel</span><span class="o">.</span><span class="n">plots</span><span class="p">[</span><span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="ow">is</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="s">&quot;is_data&quot;</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+                    <span class="k">return</span> <span class="p">[[</span><span class="n">fit_option</span><span class="p">,</span> <span class="n">fit_hint</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onSelect</span><span class="p">]]</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="k">return</span> <span class="p">[]</span> 
+            <span class="k">return</span> <span class="p">[[</span><span class="n">fit_option</span><span class="p">,</span> <span class="n">fit_hint</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onSelect</span><span class="p">]]</span>
+        <span class="k">else</span><span class="p">:</span>
+            
+            <span class="c"># if is_data is true , this in an actual data loaded</span>
+            <span class="c">#else it is a data created from a theory model</span>
+            <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="s">&quot;is_data&quot;</span><span class="p">):</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+                    <span class="k">return</span> <span class="p">[[</span><span class="n">fit_option</span><span class="p">,</span> <span class="n">fit_hint</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onSelect</span><span class="p">]]</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="k">return</span> <span class="p">[]</span>
+            <span class="k">return</span> <span class="p">[[</span><span class="n">fit_option</span><span class="p">,</span> <span class="n">fit_hint</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onSelect</span><span class="p">]]</span>
+        <span class="k">return</span> <span class="p">[]</span>
+</div>
+<div class="viewcode-block" id="Plugin.get_panels"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.get_panels">[docs]</a>    <span class="k">def</span> <span class="nf">get_panels</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create and return a list of panel objects</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="c">#self.parent.Bind(EVT_FITSTATE_UPDATE, self.on_set_state_helper)</span>
+        <span class="c"># Creation of the fit panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">frame</span> <span class="o">=</span> <span class="n">MDIFrame</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;None&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">200</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span> <span class="o">=</span> <span class="n">FitPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">frame</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">frame</span><span class="o">.</span><span class="n">set_panel</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_frame_set_helper</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_add_new_page</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="c">#Set the manager for the main panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="c"># List of windows used for the perspective</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">perspective</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">perspective</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">window_name</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">result_frame</span> <span class="o">=</span> <span class="n">MDIFrame</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="n">ResultPanel</span><span class="o">.</span><span class="n">window_caption</span><span class="p">,</span> <span class="p">(</span><span class="mi">220</span><span class="p">,</span> <span class="mi">200</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">result_panel</span> <span class="o">=</span> <span class="n">ResultPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">result_frame</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">perspective</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">result_panel</span><span class="o">.</span><span class="n">window_name</span><span class="p">)</span>
+       
+        <span class="c">#index number to create random model name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">index_model</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">index_theory</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">EVT_SLICER_PANEL</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_slicer_event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">EVT_SLICER_PARS_UPDATE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onEVT_SLICER_PANEL</span><span class="p">)</span>
+        <span class="c">#self.parent._mgr.Bind(wx.aui.EVT_AUI_PANE_CLOSE,self._onclearslicer)</span>
+        <span class="c">#Create reader when fitting panel are created</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_reader</span> <span class="o">=</span> <span class="n">Reader</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">set_state</span><span class="p">)</span>
+        <span class="c">#append that reader to list of available reader</span>
+        <span class="n">loader</span> <span class="o">=</span> <span class="n">Loader</span><span class="p">()</span>
+        <span class="n">loader</span><span class="o">.</span><span class="n">associate_file_reader</span><span class="p">(</span><span class="s">&quot;.fitv&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_reader</span><span class="p">)</span>
+        <span class="c">#Send the fitting panel to guiframe</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mypanels</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mypanels</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">result_panel</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">mypanels</span>
+    </div>
+<div class="viewcode-block" id="Plugin.clear_panel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.clear_panel">[docs]</a>    <span class="k">def</span> <span class="nf">clear_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">clear_panel</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="Plugin.set_default_perspective"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_default_perspective">[docs]</a>    <span class="k">def</span> <span class="nf">set_default_perspective</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Call back method that True to notify the parent that the current plug-in</span>
+<span class="sd">        can be set as default perspective.</span>
+<span class="sd">        when returning False, the plug-in is not candidate for an automatic</span>
+<span class="sd">        default perspective setting</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">True</span>
+    </div>
+<div class="viewcode-block" id="Plugin.delete_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.delete_data">[docs]</a>    <span class="k">def</span> <span class="nf">delete_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        delete  the given data from panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">delete_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Plugin.set_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        receive a list of data to fit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">data_list</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">selected_data_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">add_fit_page</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data_list</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="n">MAX_NBR_DATA</span><span class="p">:</span>
+                <span class="kn">from</span> <span class="nn">fitting_widgets</span> <span class="kn">import</span> <span class="n">DataDialog</span>
+                <span class="n">dlg</span> <span class="o">=</span> <span class="n">DataDialog</span><span class="p">(</span><span class="n">data_list</span><span class="o">=</span><span class="n">data_list</span><span class="p">,</span> <span class="n">nb_data</span><span class="o">=</span><span class="n">MAX_NBR_DATA</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+                    <span class="n">selected_data_list</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+                <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+                
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">selected_data_list</span> <span class="o">=</span> <span class="n">data_list</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">group_id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+                <span class="k">for</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">selected_data_list</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="c"># 2D has no same group_id</span>
+                        <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;Data2D&#39;</span><span class="p">:</span>
+                            <span class="n">group_id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+                        <span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">group_id</span>
+                        <span class="k">if</span> <span class="n">group_id</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">data</span><span class="o">.</span><span class="n">list_group_id</span><span class="p">:</span>
+                            <span class="n">data</span><span class="o">.</span><span class="n">list_group_id</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">group_id</span><span class="p">)</span>
+                        <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">add_fit_page</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">data</span><span class="p">])</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fitting Set_data: &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+    </div>
+<div class="viewcode-block" id="Plugin.set_theory"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_theory">[docs]</a>    <span class="k">def</span> <span class="nf">set_theory</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">theory_list</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#set the model state for a given theory_state:</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">theory_list</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">_</span><span class="p">,</span> <span class="n">theory_state</span> <span class="o">=</span> <span class="n">item</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">set_model_state</span><span class="p">(</span><span class="n">theory_state</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fitting: cannot deal with the theory received&quot;</span>
+                <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;set_theory &quot;</span> <span class="o">+</span> <span class="n">msg</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">))</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                             <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+            </div>
+<div class="viewcode-block" id="Plugin.set_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_state">[docs]</a>    <span class="k">def</span> <span class="nf">set_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">format</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Call-back method for the fit page state reader.</span>
+<span class="sd">        This method is called when a .fitv/.svs file is loaded.</span>
+<span class="sd">        </span>
+<span class="sd">        : param state: PageState object</span>
+<span class="sd">        : param datainfo: data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#state = self.state_reader.get_state()</span>
+        <span class="k">if</span> <span class="n">state</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">state</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+            <span class="c"># store fitting state in temp_state</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># index to start with for a new set_state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_index</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c"># state file format</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sfile_ext</span> <span class="o">=</span> <span class="n">format</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_set_state_helper</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="Plugin.on_set_state_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.on_set_state_helper">[docs]</a>    <span class="k">def</span>  <span class="nf">on_set_state_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set_state_helper. This actually sets state</span>
+<span class="sd">        after plotting data from state file.</span>
+<span class="sd">        </span>
+<span class="sd">        : event: FitStateUpdateEvent called</span>
+<span class="sd">            by dataloader.plot_data from guiframe</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_index</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mypanels</span><span class="p">)</span> <span class="o">&lt;=</span> <span class="mi">0</span> \
+            <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">sfile_ext</span> <span class="o">==</span> <span class="s">&#39;.svs&#39;</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span> <span class="o">=</span> <span class="p">[]</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">state_index</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">return</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># Load fitting state</span>
+            <span class="n">state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">state_index</span><span class="p">]</span>
+            <span class="c">#panel state should have model selection to set_state</span>
+            <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">formfactorcombobox</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="c">#set state</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">create_gui_data</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+                <span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="n">data_list</span><span class="o">=</span><span class="p">{</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">:</span> <span class="n">data</span><span class="p">})</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                                        <span class="n">title</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">title</span><span class="p">))</span>
+                <span class="c">#need to be fix later make sure we are sendind guiframe.data</span>
+                <span class="c">#to panel</span>
+                <span class="n">state</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">data</span>
+                <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">set_state</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="c">#just set data because set_state won&#39;t work</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">create_gui_data</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+                <span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="n">data_list</span><span class="o">=</span><span class="p">{</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">:</span> <span class="n">data</span><span class="p">})</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                                        <span class="n">title</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">title</span><span class="p">))</span>
+                <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">add_fit_page</span><span class="p">([</span><span class="n">data</span><span class="p">])</span>
+                <span class="n">caption</span> <span class="o">=</span> <span class="n">page</span><span class="o">.</span><span class="n">window_caption</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">store_data</span><span class="p">(</span><span class="n">uid</span><span class="o">=</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span> <span class="n">data_list</span><span class="o">=</span><span class="n">page</span><span class="o">.</span><span class="n">get_data_list</span><span class="p">(),</span>
+                        <span class="n">caption</span><span class="o">=</span><span class="n">caption</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">mypanels</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">page</span><span class="p">)</span>
+                
+            <span class="c"># get ready for the next set_state</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state_index</span> <span class="o">+=</span> <span class="mi">1</span>
+
+            <span class="c">#reset state variables to default when all set_state is finished.</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span><span class="p">)</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_index</span><span class="p">:</span>
+                
+                <span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span> <span class="o">=</span> <span class="p">[]</span>
+                <span class="c">#self.state_index = 0</span>
+                <span class="c"># Make sure the user sees the fitting panel after loading</span>
+                <span class="c">#self.parent.set_perspective(self.perspective)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">on_perspective</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state_index</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="k">raise</span>
+        </div>
+<div class="viewcode-block" id="Plugin.set_param2fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_param2fit">[docs]</a>    <span class="k">def</span> <span class="nf">set_param2fit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">param2fit</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the list of param names to fit for fitprobelm</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_param2fit</span><span class="p">(</span><span class="n">param2fit</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Plugin.set_graph_id"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_graph_id">[docs]</a>    <span class="k">def</span> <span class="nf">set_graph_id</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">graph_id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set graph_id for fitprobelm</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_graph_id</span><span class="p">(</span><span class="n">graph_id</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Plugin.get_graph_id"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.get_graph_id">[docs]</a>    <span class="k">def</span> <span class="nf">get_graph_id</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">uid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set graph_id for fitprobelm</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">get_graph_id</span><span class="p">()</span>
+                          </div>
+<div class="viewcode-block" id="Plugin.save_fit_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.save_fit_state">[docs]</a>    <span class="k">def</span> <span class="nf">save_fit_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filepath</span><span class="p">,</span> <span class="n">fitstate</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        save fit page state into file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_reader</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="n">filepath</span><span class="p">,</span> <span class="n">fitstate</span><span class="o">=</span><span class="n">fitstate</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="Plugin.set_fit_weight"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_fit_weight">[docs]</a>    <span class="k">def</span> <span class="nf">set_fit_weight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">flag</span><span class="p">,</span> <span class="n">is2d</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the fit weights of a given page for all</span>
+<span class="sd">        its data by default. If fid is provide then set the range</span>
+<span class="sd">        only for the data with fid as id</span>
+<span class="sd">        :param uid: id corresponding to a fit page</span>
+<span class="sd">        :param fid: id corresponding to a fit problem (data, model)</span>
+<span class="sd">        :param weight: current dy data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">uid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_weight</span><span class="p">(</span><span class="n">flag</span><span class="o">=</span><span class="n">flag</span><span class="p">,</span> <span class="n">is2d</span><span class="o">=</span><span class="n">is2d</span><span class="p">)</span>
+                    </div>
+<div class="viewcode-block" id="Plugin.set_fit_range"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_fit_range">[docs]</a>    <span class="k">def</span> <span class="nf">set_fit_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the fitting range of a given page for all</span>
+<span class="sd">        its data by default. If fid is provide then set the range</span>
+<span class="sd">        only for the data with fid as id</span>
+<span class="sd">        :param uid: id corresponding to a fit page</span>
+<span class="sd">        :param fid: id corresponding to a fit problem (data, model)</span>
+<span class="sd">        :param qmin: minimum  value of the fit range</span>
+<span class="sd">        :param qmax: maximum  value of the fit range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">uid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="n">qmin</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="o">=</span><span class="n">qmax</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">)</span>
+      </div>
+<div class="viewcode-block" id="Plugin.schedule_for_fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.schedule_for_fit">[docs]</a>    <span class="k">def</span> <span class="nf">schedule_for_fit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">uid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the fit problem field to 0 or 1 to schedule that problem to fit.</span>
+<span class="sd">        Schedule the specified fitproblem or get the fit problem related to</span>
+<span class="sd">        the current page and set value.</span>
+<span class="sd">        :param value: integer 0 or 1</span>
+<span class="sd">        :param uid: the id related to a page contaning fitting information</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">uid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">schedule_tofit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+          </div>
+<div class="viewcode-block" id="Plugin.get_page_finder"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.get_page_finder">[docs]</a>    <span class="k">def</span> <span class="nf">get_page_finder</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return self.page_finder used also by simfitpage.py</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span>
+    </div>
+<div class="viewcode-block" id="Plugin.set_page_finder"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_page_finder">[docs]</a>    <span class="k">def</span> <span class="nf">set_page_finder</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">modelname</span><span class="p">,</span> <span class="n">names</span><span class="p">,</span> <span class="n">values</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Used by simfitpage.py to reset a parameter given the string constrainst.</span>
+<span class="sd">         </span>
+<span class="sd">        :param modelname: the name ot the model for with the parameter</span>
+<span class="sd">                            has to reset</span>
+<span class="sd">        :param value: can be a string in this case.</span>
+<span class="sd">        :param names: the paramter name</span>
+<span class="sd">         </span>
+<span class="sd">        :note: expecting park used for fit.</span>
+<span class="sd">         </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">sim_page_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">uid</span>
+        <span class="k">for</span> <span class="n">uid</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="k">if</span> <span class="n">uid</span> <span class="o">!=</span> <span class="n">sim_page_id</span> <span class="ow">and</span> <span class="n">uid</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="o">.</span><span class="n">uid</span><span class="p">:</span>
+                <span class="nb">list</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">get_model</span><span class="p">()</span>
+                <span class="n">model</span> <span class="o">=</span> <span class="nb">list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="k">if</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="n">modelname</span><span class="p">:</span>
+                    <span class="n">value</span><span class="o">.</span><span class="n">set_model_param</span><span class="p">(</span><span class="n">names</span><span class="p">,</span> <span class="n">values</span><span class="p">)</span>
+                    <span class="k">break</span>
+         </div>
+<div class="viewcode-block" id="Plugin.split_string"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.split_string">[docs]</a>    <span class="k">def</span> <span class="nf">split_string</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        receive a word containing dot and split it. used to split parameterset</span>
+<span class="sd">        name into model name and parameter name example: ::</span>
+<span class="sd">        </span>
+<span class="sd">            paramaterset (item) = M1.A</span>
+<span class="sd">            Will return model_name = M1 , parameter name = A</span>
+<span class="sd">            </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&quot;.&quot;</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">param_names</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;\.&quot;</span><span class="p">,</span> <span class="n">item</span><span class="p">)</span>
+            <span class="n">model_name</span> <span class="o">=</span> <span class="n">param_names</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="c">##Assume max len is 3; eg., M0.radius.width</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">param_names</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
+                <span class="n">param_name</span> <span class="o">=</span> <span class="n">param_names</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot;.&quot;</span> <span class="o">+</span> <span class="n">param_names</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">param_name</span> <span class="o">=</span> <span class="n">param_names</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            <span class="k">return</span> <span class="n">model_name</span><span class="p">,</span> <span class="n">param_name</span>
+   </div>
+<div class="viewcode-block" id="Plugin.set_ftol"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_ftol">[docs]</a>    <span class="k">def</span> <span class="nf">set_ftol</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ftol</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set ftol: Relative error desired in the sum of chi squares.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># check if it is flaot</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">f_tol</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">ftol</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c"># default</span>
+            <span class="n">f_tol</span> <span class="o">=</span> <span class="n">SAS_F_TOL</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">ftol</span> <span class="o">=</span> <span class="n">f_tol</span>
+        <span class="c"># update ftol menu help strings</span>
+        <span class="n">ftol_help</span> <span class="o">=</span> <span class="s">&quot;Change the current FTolerance (=</span><span class="si">%s</span><span class="s">) &quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ftol</span><span class="p">)</span>
+        <span class="n">ftol_help</span> <span class="o">+=</span> <span class="s">&quot;of Simple FitEngine...&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">SetHelpString</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_tol</span><span class="p">,</span> <span class="n">ftol_help</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Plugin.show_ftol_dialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.show_ftol_dialog">[docs]</a>    <span class="k">def</span> <span class="nf">show_ftol_dialog</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Dialog to select ftol for Scipy</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">ftol_dialog</span> <span class="kn">import</span> <span class="n">ChangeFtol</span>
+        <span class="n">dialog</span> <span class="o">=</span> <span class="n">ChangeFtol</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span>
+        <span class="n">result</span> <span class="o">=</span> <span class="n">dialog</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">result</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="n">dialog</span><span class="o">.</span><span class="n">get_ftol</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">set_ftol</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;The ftol (LeastSq) is set to </span><span class="si">%s</span><span class="s">.&quot;</span> <span class="o">%</span> <span class="n">value</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error in the selection... No change in ftol.&quot;</span>
+            <span class="c"># post event for info</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;warning&#39;</span><span class="p">))</span>
+        <span class="n">dialog</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="Plugin.on_bumps_options"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.on_bumps_options">[docs]</a>    <span class="k">def</span> <span class="nf">on_bumps_options</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="kn">from</span> <span class="nn">bumps.gui.fit_dialog</span> <span class="kn">import</span> <span class="n">OpenFitOptions</span>
+        <span class="n">OpenFitOptions</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="Plugin.stop_fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.stop_fit">[docs]</a>    <span class="k">def</span> <span class="nf">stop_fit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">uid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Stop the fit engine</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">uid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_thread_list</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="n">calc_fit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_thread_list</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span>
+            <span class="k">if</span> <span class="n">calc_fit</span> <span class="ow">is</span> <span class="ow">not</span>  <span class="bp">None</span> <span class="ow">and</span> <span class="n">calc_fit</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+                <span class="n">calc_fit</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fit stop!&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_thread_list</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span>
+        <span class="c">#set the fit button label of page when fit stop is trigger from</span>
+        <span class="c">#simultaneous fit pane</span>
+        <span class="n">sim_flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">uid</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">uid</span>
+        <span class="n">batch_flag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">uid</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="o">.</span><span class="n">uid</span>
+        <span class="k">if</span> <span class="n">sim_flag</span> <span class="ow">or</span> <span class="n">batch_flag</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">uid</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">get_scheduled</span><span class="p">()</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">uid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">opened_pages</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                        <span class="n">panel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">opened_pages</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span>
+                        <span class="n">panel</span><span class="o">.</span><span class="n">_on_fit_complete</span><span class="p">()</span>
+  </div>
+<div class="viewcode-block" id="Plugin.set_smearer"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.set_smearer">[docs]</a>    <span class="k">def</span> <span class="nf">set_smearer</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">smearer</span><span class="p">,</span> <span class="n">fid</span><span class="p">,</span> <span class="n">qmin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">qmax</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">draw</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+                    <span class="n">enable_smearer</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get a smear object and store it to a fit problem of fid as id. If proper</span>
+<span class="sd">        flag is enable , will plot the theory with smearing information.</span>
+<span class="sd">        </span>
+<span class="sd">        :param smearer: smear object to allow smearing data of id fid</span>
+<span class="sd">        :param enable_smearer: Define whether or not all (data, model) contained</span>
+<span class="sd">            in the structure of id uid will be smeared before fitting.</span>
+<span class="sd">        :param qmin: the maximum value of the theory plotting range</span>
+<span class="sd">        :param qmax: the maximum value of the theory plotting range</span>
+<span class="sd">        :param draw: Determine if the theory needs to be plot</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">uid</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">enable_smearing</span><span class="p">(</span><span class="n">flag</span><span class="o">=</span><span class="n">enable_smearer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_smearer</span><span class="p">(</span><span class="n">smearer</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">draw</span><span class="p">:</span>
+            <span class="c">## draw model 1D with smeared data</span>
+            <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">get_fit_data</span><span class="p">(</span><span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;set_mearer requires at least data.</span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Got data = </span><span class="si">%s</span><span class="s"> .</span><span class="se">\n</span><span class="s">&quot;</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="k">return</span>
+                <span class="c">#raise ValueError, msg</span>
+            <span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">get_model</span><span class="p">(</span><span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">model</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span>
+            <span class="n">enable1D</span> <span class="o">=</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">)</span>
+            <span class="n">enable2D</span> <span class="o">=</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data2D</span><span class="p">)</span>
+            <span class="c">## if user has already selected a model to plot</span>
+            <span class="c">## redraw the model with data smeared</span>
+            <span class="n">smear</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">get_smearer</span><span class="p">(</span><span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">)</span>
+
+            <span class="c"># compute weight for the current data</span>
+            <span class="n">weight</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">get_weight</span><span class="p">(</span><span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">)</span>
+
+            <span class="bp">self</span><span class="o">.</span><span class="n">draw_model</span><span class="p">(</span><span class="n">model</span><span class="o">=</span><span class="n">model</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="n">page_id</span><span class="o">=</span><span class="n">uid</span><span class="p">,</span> <span class="n">smearer</span><span class="o">=</span><span class="n">smear</span><span class="p">,</span>
+                <span class="n">enable1D</span><span class="o">=</span><span class="n">enable1D</span><span class="p">,</span> <span class="n">enable2D</span><span class="o">=</span><span class="n">enable2D</span><span class="p">,</span>
+                <span class="n">qmin</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="o">=</span><span class="n">qmax</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="n">weight</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_mac_sleep</span><span class="p">(</span><span class="mf">0.2</span><span class="p">)</span>
+            </div>
+    <span class="k">def</span> <span class="nf">_mac_sleep</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sec</span><span class="o">=</span><span class="mf">0.2</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Give sleep to MAC</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">ON_MAC</span><span class="p">:</span>
+            <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="n">sec</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="Plugin.draw_model"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.draw_model">[docs]</a>    <span class="k">def</span> <span class="nf">draw_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">,</span> <span class="n">page_id</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">smearer</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                   <span class="n">enable1D</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">enable2D</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+                   <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                   <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                   <span class="n">toggle_mode_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+                   <span class="n">qmin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">qmax</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                   <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="s">&#39;model&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw model.</span>
+<span class="sd">        </span>
+<span class="sd">        :param model: the model to draw</span>
+<span class="sd">        :param name: the name of the model to draw</span>
+<span class="sd">        :param data: the data on which the model is based to be drawn</span>
+<span class="sd">        :param description: model&#39;s description</span>
+<span class="sd">        :param enable1D: if true enable drawing model 1D</span>
+<span class="sd">        :param enable2D: if true enable drawing model 2D</span>
+<span class="sd">        :param qmin:  Range&#39;s minimum value to draw model</span>
+<span class="sd">        :param qmax:  Range&#39;s maximum value to draw model</span>
+<span class="sd">        :param qstep: number of step to divide the x and y-axis</span>
+<span class="sd">        :param update_chisqr: update chisqr [bool]</span>
+<span class="sd">             </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#self.weight = weight</span>
+        <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">enable2D</span><span class="p">:</span>
+            <span class="c">## draw model 1D with no loaded data</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model1D</span><span class="p">(</span><span class="n">model</span><span class="o">=</span><span class="n">model</span><span class="p">,</span>
+                               <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                               <span class="n">page_id</span><span class="o">=</span><span class="n">page_id</span><span class="p">,</span>
+                               <span class="n">enable1D</span><span class="o">=</span><span class="n">enable1D</span><span class="p">,</span>
+                               <span class="n">smearer</span><span class="o">=</span><span class="n">smearer</span><span class="p">,</span>
+                               <span class="n">qmin</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span>
+                               <span class="n">qmax</span><span class="o">=</span><span class="n">qmax</span><span class="p">,</span>
+                               <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">,</span>
+                               <span class="n">weight</span><span class="o">=</span><span class="n">weight</span><span class="p">,</span>
+                               <span class="n">toggle_mode_on</span><span class="o">=</span><span class="n">toggle_mode_on</span><span class="p">,</span>
+                               <span class="n">state</span><span class="o">=</span><span class="n">state</span><span class="p">,</span>
+                               <span class="n">update_chisqr</span><span class="o">=</span><span class="n">update_chisqr</span><span class="p">,</span>
+                               <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c">## draw model 2D with no initial data</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_draw_model2D</span><span class="p">(</span><span class="n">model</span><span class="o">=</span><span class="n">model</span><span class="p">,</span>
+                                <span class="n">page_id</span><span class="o">=</span><span class="n">page_id</span><span class="p">,</span>
+                                <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                                <span class="n">enable2D</span><span class="o">=</span><span class="n">enable2D</span><span class="p">,</span>
+                                <span class="n">smearer</span><span class="o">=</span><span class="n">smearer</span><span class="p">,</span>
+                                <span class="n">qmin</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span>
+                                <span class="n">qmax</span><span class="o">=</span><span class="n">qmax</span><span class="p">,</span>
+                                <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">,</span>
+                                <span class="n">weight</span><span class="o">=</span><span class="n">weight</span><span class="p">,</span>
+                                <span class="n">state</span><span class="o">=</span><span class="n">state</span><span class="p">,</span>
+                                <span class="n">toggle_mode_on</span><span class="o">=</span><span class="n">toggle_mode_on</span><span class="p">,</span>
+                                <span class="n">update_chisqr</span><span class="o">=</span><span class="n">update_chisqr</span><span class="p">,</span>
+                                <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="Plugin.onFit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.onFit">[docs]</a>    <span class="k">def</span> <span class="nf">onFit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">uid</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get series of data, model, associates parameters and range and send then</span>
+<span class="sd">        to  series of fit engines. Fit data and model, display result to</span>
+<span class="sd">        corresponding panels.</span>
+<span class="sd">        :param uid: id related to the panel currently calling this fit function.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">uid</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&quot;no page to fit&quot;</span><span class="p">)</span> <span class="c"># Should never happen</span>
+
+        <span class="c"># Remember the user selected fit engine before the fit.  Simultaneous</span>
+        <span class="c"># fitting may change the selected engine, so it needs to be restored</span>
+        <span class="c"># when the fit is complete.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_gui_engine</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span>
+
+        <span class="n">sim_page_uid</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="p">,</span> <span class="s">&#39;uid&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+        <span class="n">batch_page_uid</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="p">,</span> <span class="s">&#39;uid&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+
+        <span class="k">if</span> <span class="n">uid</span> <span class="o">==</span> <span class="n">sim_page_uid</span><span class="p">:</span>
+            <span class="n">fit_type</span> <span class="o">=</span> <span class="s">&#39;simultaneous&#39;</span>
+        <span class="k">elif</span> <span class="n">uid</span> <span class="o">==</span> <span class="n">batch_page_uid</span><span class="p">:</span>
+            <span class="n">fit_type</span> <span class="o">=</span> <span class="s">&#39;combined_batch&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">fit_type</span> <span class="o">=</span> <span class="s">&#39;single&#39;</span>
+
+        <span class="c"># if constrained fit, don&#39;t use scipy leastsq directly</span>
+        <span class="k">if</span> <span class="n">fit_type</span> <span class="o">==</span> <span class="s">&#39;simultaneous&#39;</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="s">&quot;park&quot;</span><span class="p">,</span><span class="s">&quot;bumps&quot;</span><span class="p">):</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_on_change_engine</span><span class="p">(</span><span class="n">engine</span><span class="o">=</span><span class="s">&#39;bumps&#39;</span><span class="p">)</span>
+
+
+        <span class="n">fitter_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">sim_fitter</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">fit_type</span> <span class="o">==</span> <span class="s">&#39;simultaneous&#39;</span><span class="p">:</span>
+            <span class="c">#simulatanous fit only one engine need to be created</span>
+            <span class="n">sim_fitter</span> <span class="o">=</span> <span class="n">Fit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span><span class="p">)</span>
+            <span class="n">sim_fitter</span><span class="o">.</span><span class="n">fitter_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">uid</span>
+            <span class="n">fitter_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sim_fitter</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">current_pg</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">list_page_id</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">fit_id</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">for</span> <span class="n">page_id</span><span class="p">,</span> <span class="n">page_info</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c"># For simulfit (uid give with None), do for-loop</span>
+            <span class="c"># if uid is specified (singlefit), do it only on the page.</span>
+            <span class="k">if</span> <span class="n">page_id</span> <span class="ow">in</span> <span class="p">(</span><span class="n">sim_page_uid</span><span class="p">,</span> <span class="n">batch_page_uid</span><span class="p">):</span> <span class="k">continue</span>
+            <span class="k">if</span> <span class="n">fit_type</span> <span class="o">==</span> <span class="s">&quot;single&quot;</span> <span class="ow">and</span> <span class="n">page_id</span> <span class="o">!=</span> <span class="n">uid</span><span class="p">:</span> <span class="k">continue</span>
+
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">page_info</span><span class="o">.</span><span class="n">get_scheduled</span><span class="p">()</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                    <span class="n">page_info</span><span class="o">.</span><span class="n">nbr_residuals_computed</span> <span class="o">=</span> <span class="mi">0</span>
+                    <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">set_fit_weight</span><span class="p">(</span><span class="n">uid</span><span class="o">=</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span>
+                                     <span class="n">flag</span><span class="o">=</span><span class="n">page</span><span class="o">.</span><span class="n">get_weight_flag</span><span class="p">(),</span>
+                                     <span class="n">is2d</span><span class="o">=</span><span class="n">page</span><span class="o">.</span><span class="n">_is_2D</span><span class="p">())</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">page</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">:</span>
+                        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;No fitting parameters for </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="n">page</span><span class="o">.</span><span class="n">window_caption</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="n">page</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span>
+                                                 <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+                        <span class="k">return</span> <span class="bp">False</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">page</span><span class="o">.</span><span class="n">_update_paramv_on_fit</span><span class="p">():</span>
+                        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fitting range or parameter values are&quot;</span>
+                        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; invalid in </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
+                                    <span class="n">page</span><span class="o">.</span><span class="n">window_caption</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="n">page</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span>
+                                     <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+                        <span class="k">return</span> <span class="bp">False</span>
+
+                    <span class="n">pars</span> <span class="o">=</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">element</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="k">for</span> <span class="n">element</span> <span class="ow">in</span> <span class="n">page</span><span class="o">.</span><span class="n">param_toFit</span><span class="p">]</span>
+                    <span class="n">fitproblem_list</span> <span class="o">=</span> <span class="n">page_info</span><span class="o">.</span><span class="n">values</span><span class="p">()</span>
+                    <span class="k">for</span> <span class="n">fitproblem</span> <span class="ow">in</span>  <span class="n">fitproblem_list</span><span class="p">:</span>
+                        <span class="k">if</span> <span class="n">sim_fitter</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                            <span class="n">fitter</span> <span class="o">=</span> <span class="n">Fit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span><span class="p">)</span>
+                            <span class="n">fitter</span><span class="o">.</span><span class="n">fitter_id</span> <span class="o">=</span> <span class="n">page_id</span>
+                            <span class="n">fitter_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">fitter</span><span class="p">)</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="n">fitter</span> <span class="o">=</span> <span class="n">sim_fitter</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">_add_problem_to_fit</span><span class="p">(</span><span class="n">fitproblem</span><span class="o">=</span><span class="n">fitproblem</span><span class="p">,</span>
+                                             <span class="n">pars</span><span class="o">=</span><span class="n">pars</span><span class="p">,</span>
+                                             <span class="n">fitter</span><span class="o">=</span><span class="n">fitter</span><span class="p">,</span>
+                                             <span class="n">fit_id</span><span class="o">=</span><span class="n">fit_id</span><span class="p">)</span>
+                        <span class="n">fit_id</span> <span class="o">+=</span> <span class="mi">1</span>
+                    <span class="n">list_page_id</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span>
+                    <span class="n">page_info</span><span class="o">.</span><span class="n">clear_model_param</span><span class="p">()</span>
+            <span class="k">except</span> <span class="ne">KeyboardInterrupt</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fitting terminated&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span>
+                                                      <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+                <span class="k">return</span> <span class="bp">True</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fitting error: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span>
+                                                      <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+                <span class="k">return</span> <span class="bp">False</span>
+        <span class="c">## If a thread is already started, stop it</span>
+        <span class="c">#if self.calc_fit!= None and self.calc_fit.isrunning():</span>
+        <span class="c">#    self.calc_fit.stop()</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fitting is in progress...&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;progress&quot;</span><span class="p">))</span>
+        
+        <span class="c">#Handler used for park engine displayed message</span>
+        <span class="n">handler</span> <span class="o">=</span> <span class="n">ConsoleUpdate</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                                <span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span>
+                                <span class="n">improvement_delta</span><span class="o">=</span><span class="mf">0.1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_mac_sleep</span><span class="p">(</span><span class="mf">0.2</span><span class="p">)</span>
+
+        <span class="c"># batch fit</span>
+        <span class="n">batch_inputs</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="n">batch_outputs</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="k">if</span> <span class="n">fit_type</span> <span class="o">==</span> <span class="s">&quot;simultaneous&quot;</span><span class="p">:</span>
+            <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span>
+        <span class="k">elif</span> <span class="n">fit_type</span> <span class="o">==</span> <span class="s">&quot;combined_batch&quot;</span><span class="p">:</span>
+            <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="n">uid</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">page</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="n">calc_fit</span> <span class="o">=</span> <span class="n">FitThread</span><span class="p">(</span><span class="n">handler</span><span class="o">=</span><span class="n">handler</span><span class="p">,</span>
+                                 <span class="n">fn</span><span class="o">=</span><span class="n">fitter_list</span><span class="p">,</span>
+                                 <span class="n">pars</span><span class="o">=</span><span class="n">pars</span><span class="p">,</span>
+                                 <span class="n">batch_inputs</span><span class="o">=</span><span class="n">batch_inputs</span><span class="p">,</span>
+                                 <span class="n">batch_outputs</span><span class="o">=</span><span class="n">batch_outputs</span><span class="p">,</span>
+                                 <span class="n">page_id</span><span class="o">=</span><span class="n">list_page_id</span><span class="p">,</span>
+                                 <span class="n">completefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_batch_fit_complete</span><span class="p">,</span>
+                                 <span class="n">ftol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">ftol</span><span class="p">,</span>
+                                 <span class="n">reset_flag</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">batch_reset_flag</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c">## Perform more than 1 fit at the time</span>
+            <span class="n">calc_fit</span> <span class="o">=</span> <span class="n">FitThread</span><span class="p">(</span><span class="n">handler</span><span class="o">=</span><span class="n">handler</span><span class="p">,</span>
+                                    <span class="n">fn</span><span class="o">=</span><span class="n">fitter_list</span><span class="p">,</span>
+                                    <span class="n">batch_inputs</span><span class="o">=</span><span class="n">batch_inputs</span><span class="p">,</span>
+                                    <span class="n">batch_outputs</span><span class="o">=</span><span class="n">batch_outputs</span><span class="p">,</span>
+                                    <span class="n">page_id</span><span class="o">=</span><span class="n">list_page_id</span><span class="p">,</span>
+                                    <span class="n">updatefn</span><span class="o">=</span><span class="n">handler</span><span class="o">.</span><span class="n">update_fit</span><span class="p">,</span>
+                                    <span class="n">completefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_fit_completed</span><span class="p">,</span>
+                                    <span class="n">ftol</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">ftol</span><span class="p">)</span>
+        <span class="c">#self.fit_thread_list[current_page_id] = calc_fit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_thread_list</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span> <span class="o">=</span> <span class="n">calc_fit</span>
+        <span class="n">calc_fit</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>
+        <span class="n">calc_fit</span><span class="o">.</span><span class="n">ready</span><span class="p">(</span><span class="mf">2.5</span><span class="p">)</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fitting is in progress...&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;progress&quot;</span><span class="p">))</span>
+        
+        <span class="k">return</span> <span class="bp">True</span>
+</div>
+<div class="viewcode-block" id="Plugin.remove_plot"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.remove_plot">[docs]</a>    <span class="k">def</span> <span class="nf">remove_plot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">theory</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        remove model plot when a fit page is closed</span>
+<span class="sd">        :param uid: the id related to the fitpage to close</span>
+<span class="sd">        :param fid: the id of the fitproblem(data, model, range,etc)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">uid</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="k">return</span>
+        <span class="n">fitproblemList</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">get_fit_problem</span><span class="p">(</span><span class="n">fid</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">fitproblem</span> <span class="ow">in</span> <span class="n">fitproblemList</span><span class="p">:</span>
+            <span class="n">data</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_fit_data</span><span class="p">()</span>
+            <span class="n">model</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_model</span><span class="p">()</span>
+            <span class="n">plot_id</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">if</span> <span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">plot_id</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="o">+</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span>
+            <span class="k">if</span> <span class="n">theory</span><span class="p">:</span>
+                <span class="n">plot_id</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="o">+</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span>
+            <span class="n">group_id</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="n">plot_id</span><span class="p">,</span>
+                                                   <span class="n">group_id</span><span class="o">=</span><span class="n">group_id</span><span class="p">,</span>
+                                                   <span class="n">action</span><span class="o">=</span><span class="s">&#39;remove&#39;</span><span class="p">))</span>
+           </div>
+<div class="viewcode-block" id="Plugin.store_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.store_data">[docs]</a>    <span class="k">def</span> <span class="nf">store_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">data_list</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">caption</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Recieve a list of data and store them ans well as a caption of</span>
+<span class="sd">        the fit page where they come from.</span>
+<span class="sd">        :param uid: if related to a fit page</span>
+<span class="sd">        :param data_list: list of data to fit</span>
+<span class="sd">        :param caption: caption of the window related to these data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">data_list</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data_list</span> <span class="o">=</span> <span class="p">[]</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_fit_data</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data_list</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">caption</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_fit_tab_caption</span><span class="p">(</span><span class="n">caption</span><span class="o">=</span><span class="n">caption</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="Plugin.on_add_new_page"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.on_add_new_page">[docs]</a>    <span class="k">def</span> <span class="nf">on_add_new_page</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        ask fit panel to create a new empty page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">add_empty_page</span><span class="p">()</span>
+            <span class="c"># add data associated to the page created</span>
+            <span class="k">if</span> <span class="n">page</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Page Created&quot;</span><span class="p">,</span>
+                                               <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Page was already Created&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                       <span class="n">info</span><span class="o">=</span><span class="s">&quot;warning&quot;</span><span class="p">))</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Creating Fit page: </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+        </div>
+<div class="viewcode-block" id="Plugin.add_fit_page"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.add_fit_page">[docs]</a>    <span class="k">def</span> <span class="nf">add_fit_page</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        given a data, ask to the fitting panel to create a new fitting page,</span>
+<span class="sd">        get this page and store it into the page_finder of this plug-in</span>
+<span class="sd">        :param data: is a list of data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="c"># page could be None when loading state files</span>
+        <span class="k">if</span> <span class="n">page</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">page</span>
+        <span class="c">#append Data1D to the panel containing its theory</span>
+        <span class="c">#if theory already plotted</span>
+        <span class="k">if</span> <span class="n">page</span><span class="o">.</span><span class="n">uid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">:</span>
+            <span class="n">data</span> <span class="o">=</span> <span class="n">page</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+            <span class="n">theory_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">get_theory_data</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+            <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data2D</span><span class="p">):</span>
+                <span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">theory_data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">group_id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model1D&quot;</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                             <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">group_id</span><span class="o">=</span><span class="n">group_id</span><span class="p">,</span>
+                                               <span class="n">action</span><span class="o">=</span><span class="s">&quot;delete&quot;</span><span class="p">))</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_data</span><span class="p">(</span><span class="n">prev_data</span><span class="o">=</span><span class="n">theory_data</span><span class="p">,</span>
+                                             <span class="n">new_data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">theory_data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">group_id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model2D&quot;</span>
+                    <span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">theory_data</span><span class="o">.</span><span class="n">group_id</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                             <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">group_id</span><span class="o">=</span><span class="n">group_id</span><span class="p">,</span>
+                                               <span class="n">action</span><span class="o">=</span><span class="s">&quot;delete&quot;</span><span class="p">))</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_data</span><span class="p">(</span><span class="n">prev_data</span><span class="o">=</span><span class="n">theory_data</span><span class="p">,</span>
+                                             <span class="n">new_data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">store_data</span><span class="p">(</span><span class="n">uid</span><span class="o">=</span><span class="n">page</span><span class="o">.</span><span class="n">uid</span><span class="p">,</span> <span class="n">data_list</span><span class="o">=</span><span class="n">page</span><span class="o">.</span><span class="n">get_data_list</span><span class="p">(),</span>
+                        <span class="n">caption</span><span class="o">=</span><span class="n">page</span><span class="o">.</span><span class="n">window_caption</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">draw_page</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="o">.</span><span class="n">draw_page</span><span class="p">()</span>
+            
+        <span class="k">return</span> <span class="n">page</span>
+            </div>
+    <span class="k">def</span> <span class="nf">_onEVT_SLICER_PANEL</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        receive and event telling to update a panel with a name starting with</span>
+<span class="sd">        event.panel_name. this method update slicer panel</span>
+<span class="sd">        for a given interactor.</span>
+<span class="sd">        </span>
+<span class="sd">        :param event: contains type of slicer , paramaters for updating</span>
+<span class="sd">            the panel and panel_name to find the slicer &#39;s panel concerned.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">panel_name</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">panels</span><span class="p">:</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">panel_name</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">panels</span><span class="p">[</span><span class="n">item</span><span class="p">]</span><span class="o">.</span><span class="n">window_caption</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">panels</span><span class="p">[</span><span class="n">item</span><span class="p">]</span><span class="o">.</span><span class="n">set_slicer</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="n">event</span><span class="o">.</span><span class="n">params</span><span class="p">)</span>
+                
+        <span class="c">#self.parent._mgr.Update()</span>
+   
+    <span class="k">def</span> <span class="nf">_closed_fitpage</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        request fitpanel to close a given page when its unique data is removed</span>
+<span class="sd">        from the plot. close fitpage only when the a loaded data is removed</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">event</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="s">&quot;is_data&quot;</span><span class="p">):</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">event</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span> <span class="ow">or</span> \
+                <span class="n">event</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data1D&quot;</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">close_page_with_data</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+  
+    <span class="k">def</span> <span class="nf">_reset_schedule_problem</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">uid</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        unschedule or schedule all fitproblem to be fit</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># case that uid is not specified</span>
+        <span class="k">if</span> <span class="n">uid</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">page_id</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">schedule_tofit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+        <span class="c"># when uid is given</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">uid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">schedule_tofit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+                
+    <span class="k">def</span> <span class="nf">_add_problem_to_fit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fitproblem</span><span class="p">,</span> <span class="n">pars</span><span class="p">,</span> <span class="n">fitter</span><span class="p">,</span> <span class="n">fit_id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create and set fit engine with series of data and model</span>
+<span class="sd">        :param pars: list of fittable parameters</span>
+<span class="sd">        :param fitter_list: list of fit engine</span>
+<span class="sd">        :param value:  structure storing data mapped to their model, range etc.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_fit_data</span><span class="p">()</span>
+        <span class="n">model</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_model</span><span class="p">()</span>
+        <span class="n">smearer</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_smearer</span><span class="p">()</span>
+        <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_range</span><span class="p">()</span>
+
+        <span class="c">#Extra list of parameters and their constraints</span>
+        <span class="n">listOfConstraint</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">param</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_model_param</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">param</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">param</span><span class="p">:</span>
+                <span class="c">## check if constraint</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">listOfConstraint</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
+        <span class="n">new_model</span> <span class="o">=</span> <span class="n">model</span>
+        <span class="n">fitter</span><span class="o">.</span><span class="n">set_model</span><span class="p">(</span><span class="n">new_model</span><span class="p">,</span> <span class="n">fit_id</span><span class="p">,</span> <span class="n">pars</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                         <span class="n">constraints</span><span class="o">=</span><span class="n">listOfConstraint</span><span class="p">)</span>
+        <span class="n">fitter</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">fit_id</span><span class="p">,</span> <span class="n">smearer</span><span class="o">=</span><span class="n">smearer</span><span class="p">,</span> <span class="n">qmin</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span>
+                        <span class="n">qmax</span><span class="o">=</span><span class="n">qmax</span><span class="p">)</span>
+        <span class="n">fitter</span><span class="o">.</span><span class="n">select_problem_for_fit</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="n">fit_id</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
+       
+    <span class="k">def</span> <span class="nf">_onSelect</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        when Select data to fit a new page is created .Its reference is</span>
+<span class="sd">        added to self.page_finder</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">panel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_panel</span>
+        <span class="k">if</span> <span class="n">panel</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;Fitting:_onSelect: NonType panel&quot;</span>
+        <span class="n">Plugin</span><span class="o">.</span><span class="n">on_perspective</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">select_data</span><span class="p">(</span><span class="n">panel</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="Plugin.select_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.select_data">[docs]</a>    <span class="k">def</span> <span class="nf">select_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">panel</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">plottable</span> <span class="ow">in</span> <span class="n">panel</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">plottables</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">plottable</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&quot;Data1D&quot;</span><span class="p">,</span> <span class="s">&quot;Theory1D&quot;</span><span class="p">]:</span>
+                <span class="n">data_id</span> <span class="o">=</span> <span class="n">panel</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span>
+                <span class="k">if</span> <span class="n">plottable</span> <span class="o">==</span> <span class="n">panel</span><span class="o">.</span><span class="n">plots</span><span class="p">[</span><span class="n">data_id</span><span class="p">]:</span>
+                    <span class="n">data</span> <span class="o">=</span> <span class="n">plottable</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">add_fit_page</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">data</span><span class="p">])</span>
+                    <span class="k">return</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">plottable</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">add_fit_page</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="p">[</span><span class="n">data</span><span class="p">])</span>
+            </div>
+<div class="viewcode-block" id="Plugin.update_fit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.update_fit">[docs]</a>    <span class="k">def</span> <span class="nf">update_fit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">msg</span><span class="o">=</span><span class="s">&quot;&quot;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">print</span> <span class="s">&quot;update_fit result&quot;</span><span class="p">,</span> <span class="n">result</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_batch_fit_complete</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="n">pars</span><span class="p">,</span> <span class="n">page_id</span><span class="p">,</span>
+                            <span class="n">batch_outputs</span><span class="p">,</span> <span class="n">batch_inputs</span><span class="p">,</span> <span class="n">elapsed</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Display fit result in batch</span>
+<span class="sd">        :param result: list of objects received fromt fit engines</span>
+<span class="sd">        :param pars: list of  fitted parameters names</span>
+<span class="sd">        :param page_id: list of page ids which called fit function</span>
+<span class="sd">        :param elapsed: time spent at the fitting level</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_mac_sleep</span><span class="p">(</span><span class="mf">0.2</span><span class="p">)</span>
+        <span class="n">uid</span> <span class="o">=</span> <span class="n">page_id</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">uid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_thread_list</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_thread_list</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span>
+          
+        <span class="bp">self</span><span class="o">.</span><span class="n">_update_fit_button</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span>
+        <span class="n">t1</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="n">str_time</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&quot;%a, </span><span class="si">%d</span><span class="s"> %b %Y %H:%M:%S &quot;</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">(</span><span class="n">t1</span><span class="p">))</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fit completed on </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">str_time</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Duration time: </span><span class="si">%s</span><span class="s"> s.</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">elapsed</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span>
+                                              <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+       
+        <span class="k">if</span> <span class="n">batch_outputs</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">batch_outputs</span> <span class="o">=</span> <span class="p">{}</span>
+        
+        <span class="c"># format batch_outputs</span>
+        <span class="n">batch_outputs</span><span class="p">[</span><span class="s">&quot;Chi2&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">#Don&#39;t like these loops</span>
+        <span class="c"># Need to create dictionary of all fitted parameters</span>
+        <span class="c"># since the number of parameters can differ between each fit result</span>
+        <span class="k">for</span> <span class="n">list_res</span> <span class="ow">in</span> <span class="n">result</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">res</span> <span class="ow">in</span> <span class="n">list_res</span><span class="p">:</span>
+                <span class="n">model</span><span class="p">,</span> <span class="n">data</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">inputs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="k">if</span> <span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="s">&quot;model&quot;</span><span class="p">):</span>
+                    <span class="n">model</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">model</span>
+                <span class="c">#get all fittable parameters of the current model</span>
+                <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span>  <span class="n">model</span><span class="o">.</span><span class="n">getParamList</span><span class="p">():</span>
+                    <span class="k">if</span> <span class="n">param</span>  <span class="ow">not</span> <span class="ow">in</span> <span class="n">batch_outputs</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                        <span class="n">batch_outputs</span><span class="p">[</span><span class="n">param</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+                <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">getDispParamList</span><span class="p">():</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">model</span><span class="o">.</span><span class="n">is_fittable</span><span class="p">(</span><span class="n">param</span><span class="p">)</span> <span class="ow">and</span> \
+                        <span class="n">param</span> <span class="ow">in</span> <span class="n">batch_outputs</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                        <span class="k">del</span> <span class="n">batch_outputs</span><span class="p">[</span><span class="n">param</span><span class="p">]</span>
+                <span class="c"># Add fitted parameters and their error</span>
+                <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">res</span><span class="o">.</span><span class="n">param_list</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">param</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">batch_outputs</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                        <span class="n">batch_outputs</span><span class="p">[</span><span class="n">param</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+                    <span class="n">err_param</span> <span class="o">=</span> <span class="s">&quot;error on </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">param</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">err_param</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">batch_inputs</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                        <span class="n">batch_inputs</span><span class="p">[</span><span class="n">err_param</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">list_res</span> <span class="ow">in</span> <span class="n">result</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">res</span> <span class="ow">in</span> <span class="n">list_res</span><span class="p">:</span>
+                <span class="n">pid</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">fitter_id</span>
+                <span class="n">model</span><span class="p">,</span> <span class="n">data</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">inputs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="n">correct_result</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="k">if</span> <span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="s">&quot;model&quot;</span><span class="p">):</span>
+                    <span class="n">model</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">model</span>
+                <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s">&quot;sas_data&quot;</span><span class="p">):</span>
+                    <span class="n">data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">sas_data</span>
+                
+                <span class="n">is_data2d</span> <span class="o">=</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data2D</span><span class="p">)</span>
+                <span class="c">#check consistency of arrays</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">is_data2d</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">theory</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">index</span><span class="p">[</span><span class="n">res</span><span class="o">.</span><span class="n">index</span><span class="p">])</span> <span class="ow">and</span> \
+                        <span class="nb">len</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">index</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">y</span><span class="p">):</span>
+                        <span class="n">correct_result</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">copy_data</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+                    <span class="n">new_theory</span> <span class="o">=</span> <span class="n">copy_data</span><span class="o">.</span><span class="n">data</span>
+                    <span class="n">new_theory</span><span class="p">[</span><span class="n">res</span><span class="o">.</span><span class="n">index</span><span class="p">]</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">theory</span>
+                    <span class="n">new_theory</span><span class="p">[</span><span class="n">res</span><span class="o">.</span><span class="n">index</span> <span class="o">==</span> <span class="bp">False</span><span class="p">]</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">nan</span>
+                    <span class="n">correct_result</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="c">#get all fittable parameters of the current model</span>
+                <span class="n">param_list</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">getParamList</span><span class="p">()</span>
+                <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">getDispParamList</span><span class="p">():</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">model</span><span class="o">.</span><span class="n">is_fittable</span><span class="p">(</span><span class="n">param</span><span class="p">)</span> <span class="ow">and</span> \
+                        <span class="n">param</span> <span class="ow">in</span> <span class="n">param_list</span><span class="p">:</span>
+                        <span class="n">param_list</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">param</span><span class="p">)</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">correct_result</span> <span class="ow">or</span> <span class="n">res</span><span class="o">.</span><span class="n">fitness</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> \
+                    <span class="ow">not</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">fitness</span><span class="p">)</span> <span class="ow">or</span> \
+                    <span class="n">numpy</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">pvec</span> <span class="o">==</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> \
+                    <span class="n">numpy</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">pvec</span><span class="p">)):</span>
+                    <span class="n">data_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="n">data_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+                    <span class="n">model_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="n">model_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Data </span><span class="si">%s</span><span class="s"> and Model </span><span class="si">%s</span><span class="s"> did not fit.</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">data_name</span><span class="p">,</span>
+                                                                    <span class="n">model_name</span><span class="p">)</span>
+                    <span class="n">ERROR</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">NAN</span>
+                    <span class="n">cell</span> <span class="o">=</span> <span class="n">BatchCell</span><span class="p">()</span>
+                    <span class="n">cell</span><span class="o">.</span><span class="n">label</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">fitness</span>
+                    <span class="n">cell</span><span class="o">.</span><span class="n">value</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">fitness</span>
+                    <span class="n">batch_outputs</span><span class="p">[</span><span class="s">&quot;Chi2&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ERROR</span><span class="p">)</span>
+                    <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">param_list</span><span class="p">:</span>
+                        <span class="c"># save value of  fixed parameters</span>
+                        <span class="k">if</span> <span class="n">param</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">res</span><span class="o">.</span><span class="n">param_list</span><span class="p">:</span>
+                            <span class="n">batch_outputs</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">param</span><span class="p">)]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ERROR</span><span class="p">)</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="c">#save only fitted values</span>
+                            <span class="n">batch_outputs</span><span class="p">[</span><span class="n">param</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ERROR</span><span class="p">)</span>
+                            <span class="n">batch_inputs</span><span class="p">[</span><span class="s">&quot;error on </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">param</span><span class="p">)]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ERROR</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="c"># ToDo: Why sometimes res.pvec comes with numpy.float64?</span>
+                    <span class="c"># Need to fix it within ScipyEngine</span>
+                    <span class="k">if</span> <span class="n">res</span><span class="o">.</span><span class="n">pvec</span><span class="o">.</span><span class="n">__class__</span> <span class="o">==</span> <span class="n">numpy</span><span class="o">.</span><span class="n">float64</span><span class="p">:</span>
+                        <span class="n">res</span><span class="o">.</span><span class="n">pvec</span> <span class="o">=</span> <span class="p">[</span><span class="n">res</span><span class="o">.</span><span class="n">pvec</span><span class="p">]</span>
+                        
+                    <span class="n">cell</span> <span class="o">=</span> <span class="n">BatchCell</span><span class="p">()</span>
+                    <span class="n">cell</span><span class="o">.</span><span class="n">label</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">fitness</span>
+                    <span class="n">cell</span><span class="o">.</span><span class="n">value</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">fitness</span>
+                    <span class="n">batch_outputs</span><span class="p">[</span><span class="s">&quot;Chi2&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cell</span><span class="p">)</span>
+                    <span class="c"># add parameters to batch_results</span>
+                    <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">param_list</span><span class="p">:</span>
+                        <span class="c"># save value of  fixed parameters</span>
+                        <span class="k">if</span> <span class="n">param</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">res</span><span class="o">.</span><span class="n">param_list</span><span class="p">:</span>
+                            <span class="n">batch_outputs</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">param</span><span class="p">)]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">getParam</span><span class="p">(</span><span class="n">param</span><span class="p">))</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="n">index</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">param_list</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">param</span><span class="p">)</span>
+                            <span class="c">#save only fitted values</span>
+                            <span class="n">batch_outputs</span><span class="p">[</span><span class="n">param</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">pvec</span><span class="p">[</span><span class="n">index</span><span class="p">])</span>
+                            <span class="k">if</span> <span class="n">res</span><span class="o">.</span><span class="n">stderr</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> \
+                                <span class="nb">len</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">stderr</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">param_list</span><span class="p">):</span>
+                                <span class="n">item</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">stderr</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+                                <span class="n">batch_inputs</span><span class="p">[</span><span class="s">&quot;error on </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">param</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                            <span class="k">else</span><span class="p">:</span>
+                                <span class="n">batch_inputs</span><span class="p">[</span><span class="s">&quot;error on </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">param</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&#39;-&#39;</span><span class="p">)</span>
+                            <span class="n">model</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">param</span><span class="p">,</span> <span class="n">res</span><span class="o">.</span><span class="n">pvec</span><span class="p">[</span><span class="n">index</span><span class="p">])</span>
+                <span class="c">#fill the batch result with emtpy value if not in the current</span>
+                <span class="c">#model</span>
+                <span class="n">EMPTY</span> <span class="o">=</span> <span class="s">&quot;-&quot;</span>
+                <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">batch_outputs</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                    <span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">param_list</span> <span class="ow">and</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&quot;Chi2&quot;</span><span class="p">,</span> <span class="s">&quot;Data&quot;</span><span class="p">]:</span>
+                        <span class="n">batch_outputs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">EMPTY</span><span class="p">)</span>
+                                
+                <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">pid</span><span class="p">]</span><span class="o">.</span><span class="n">set_batch_result</span><span class="p">(</span><span class="n">batch_inputs</span><span class="o">=</span><span class="n">batch_inputs</span><span class="p">,</span>
+                                                       <span class="n">batch_outputs</span><span class="o">=</span><span class="n">batch_outputs</span><span class="p">)</span>
+               
+                <span class="n">cpage</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="n">pid</span><span class="p">)</span>
+                <span class="n">cpage</span><span class="o">.</span><span class="n">_on_fit_complete</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">pid</span><span class="p">][</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">]</span><span class="o">.</span><span class="n">set_result</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
+                <span class="n">fitproblem</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">pid</span><span class="p">][</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">]</span>
+                <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_range</span><span class="p">()</span>
+                <span class="n">plot_result</span> <span class="o">=</span> <span class="bp">False</span>
+                <span class="k">if</span> <span class="n">correct_result</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">is_data2d</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">_complete1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">[</span><span class="n">res</span><span class="o">.</span><span class="n">index</span><span class="p">],</span> <span class="n">y</span><span class="o">=</span><span class="n">res</span><span class="o">.</span><span class="n">theory</span><span class="p">,</span> <span class="n">page_id</span><span class="o">=</span><span class="n">pid</span><span class="p">,</span>
+                                         <span class="n">elapsed</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                                         <span class="n">index</span><span class="o">=</span><span class="n">res</span><span class="o">.</span><span class="n">index</span><span class="p">,</span> <span class="n">model</span><span class="o">=</span><span class="n">model</span><span class="p">,</span>
+                                         <span class="n">weight</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
+                                         <span class="n">toggle_mode_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                                         <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+                                         <span class="n">source</span><span class="o">=</span><span class="s">&#39;fit&#39;</span><span class="p">,</span> <span class="n">plot_result</span><span class="o">=</span><span class="n">plot_result</span><span class="p">)</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">_complete2D</span><span class="p">(</span><span class="n">image</span><span class="o">=</span><span class="n">new_theory</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                                         <span class="n">model</span><span class="o">=</span><span class="n">model</span><span class="p">,</span>
+                                         <span class="n">page_id</span><span class="o">=</span><span class="n">pid</span><span class="p">,</span> <span class="n">elapsed</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                                         <span class="n">index</span><span class="o">=</span><span class="n">res</span><span class="o">.</span><span class="n">index</span><span class="p">,</span>
+                                         <span class="n">qmin</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span>
+                                         <span class="n">qmax</span><span class="o">=</span><span class="n">qmax</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                                         <span class="n">toggle_mode_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                                         <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+                                         <span class="n">source</span><span class="o">=</span><span class="s">&#39;fit&#39;</span><span class="p">,</span> <span class="n">plot_result</span><span class="o">=</span><span class="n">plot_result</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">on_set_batch_result</span><span class="p">(</span><span class="n">page_id</span><span class="o">=</span><span class="n">pid</span><span class="p">,</span>
+                                         <span class="n">fid</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
+                                         <span class="n">batch_outputs</span><span class="o">=</span><span class="n">batch_outputs</span><span class="p">,</span>
+                                         <span class="n">batch_inputs</span><span class="o">=</span><span class="n">batch_inputs</span><span class="p">)</span>
+        
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">error</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span>
+                                              <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+        <span class="c"># Remove parameters that are not shown</span>
+        <span class="n">cpage</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="n">uid</span><span class="p">)</span>
+        <span class="n">tbatch_outputs</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="n">shownkeystr</span> <span class="o">=</span> <span class="n">cpage</span><span class="o">.</span><span class="n">get_copy_params</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">batch_outputs</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&quot;Chi2&quot;</span><span class="p">,</span> <span class="s">&quot;Data&quot;</span><span class="p">]</span> <span class="ow">or</span> <span class="n">shownkeystr</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">tbatch_outputs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">batch_outputs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
+                
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">on_set_batch_result</span><span class="p">,</span> <span class="n">tbatch_outputs</span><span class="p">,</span>
+                     <span class="n">batch_inputs</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">sub_menu</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="Plugin.on_set_batch_result"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.on_set_batch_result">[docs]</a>    <span class="k">def</span> <span class="nf">on_set_batch_result</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">page_id</span><span class="p">,</span> <span class="n">fid</span><span class="p">,</span> <span class="n">batch_outputs</span><span class="p">,</span> <span class="n">batch_inputs</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">pid</span> <span class="o">=</span> <span class="n">page_id</span>
+        <span class="k">if</span> <span class="n">fid</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">pid</span><span class="p">]:</span>
+            <span class="k">return</span>
+        <span class="n">fitproblem</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">pid</span><span class="p">][</span><span class="n">fid</span><span class="p">]</span>
+        <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">pid</span><span class="p">]</span><span class="o">.</span><span class="n">nbr_residuals_computed</span> <span class="o">-</span> <span class="mi">1</span>
+        <span class="n">residuals</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_residuals</span><span class="p">()</span>
+        <span class="n">theory_data</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_theory_data</span><span class="p">()</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_fit_data</span><span class="p">()</span>
+        <span class="n">model</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_model</span><span class="p">()</span>
+        <span class="c">#fill batch result information</span>
+        <span class="k">if</span> <span class="s">&quot;Data&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">batch_outputs</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="n">batch_outputs</span><span class="p">[</span><span class="s">&quot;Data&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="kn">from</span> <span class="nn">sas.guiframe.data_processor</span> <span class="kn">import</span> <span class="n">BatchCell</span>
+        <span class="n">cell</span> <span class="o">=</span> <span class="n">BatchCell</span><span class="p">()</span>
+        <span class="n">cell</span><span class="o">.</span><span class="n">label</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">name</span>
+        <span class="n">cell</span><span class="o">.</span><span class="n">value</span> <span class="o">=</span> <span class="n">index</span>
+        
+        <span class="k">if</span> <span class="n">theory_data</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c">#Suucessful fit</span>
+            <span class="n">theory_data</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+            <span class="n">theory_data</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="s">&quot;[</span><span class="si">%s</span><span class="s">]&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+            <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">theory_data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data2D</span><span class="p">):</span>
+                <span class="n">group_id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+                <span class="n">theory_data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">group_id</span>
+                <span class="k">if</span> <span class="n">group_id</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">theory_data</span><span class="o">.</span><span class="n">list_group_id</span><span class="p">:</span>
+                    <span class="n">theory_data</span><span class="o">.</span><span class="n">list_group_id</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">group_id</span><span class="p">)</span>
+                
+            <span class="k">try</span><span class="p">:</span>
+                <span class="c"># associate residuals plot</span>
+                <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">residuals</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data2D</span><span class="p">):</span>
+                    <span class="n">group_id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+                    <span class="n">residuals</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">group_id</span>
+                    <span class="k">if</span> <span class="n">group_id</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">residuals</span><span class="o">.</span><span class="n">list_group_id</span><span class="p">:</span>
+                        <span class="n">residuals</span><span class="o">.</span><span class="n">list_group_id</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">group_id</span><span class="p">)</span>
+                <span class="n">batch_outputs</span><span class="p">[</span><span class="s">&quot;Chi2&quot;</span><span class="p">][</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">object</span> <span class="o">=</span> <span class="p">[</span><span class="n">residuals</span><span class="p">]</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+
+        <span class="n">cell</span><span class="o">.</span><span class="n">object</span> <span class="o">=</span> <span class="p">[</span><span class="n">data</span><span class="p">,</span> <span class="n">theory_data</span><span class="p">]</span>
+        <span class="n">batch_outputs</span><span class="p">[</span><span class="s">&quot;Data&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cell</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">data</span><span class="o">.</span><span class="n">meta_data</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">batch_inputs</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="n">batch_inputs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="c">#if key.lower().strip() != &quot;loader&quot;:</span>
+            <span class="n">batch_inputs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+        <span class="n">param</span> <span class="o">=</span> <span class="s">&quot;temperature&quot;</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">sample</span><span class="p">,</span> <span class="n">param</span><span class="p">):</span>
+            <span class="k">if</span> <span class="n">param</span> <span class="ow">not</span> <span class="ow">in</span>  <span class="n">batch_inputs</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="n">batch_inputs</span><span class="p">[</span><span class="n">param</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="n">batch_inputs</span><span class="p">[</span><span class="n">param</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">temperature</span><span class="p">)</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_fit_completed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">result</span><span class="p">,</span> <span class="n">page_id</span><span class="p">,</span> <span class="n">batch_outputs</span><span class="p">,</span>
+                       <span class="n">batch_inputs</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">pars</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">elapsed</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Display result of the fit on related panel(s).</span>
+<span class="sd">        :param result: list of object generated when fit ends</span>
+<span class="sd">        :param pars: list of names of parameters fitted</span>
+<span class="sd">        :param page_id: list of page ids which called fit function</span>
+<span class="sd">        :param elapsed: time spent at the fitting level</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">t1</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="n">str_time</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&quot;%a, </span><span class="si">%d</span><span class="s"> %b %Y %H:%M:%S &quot;</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">(</span><span class="n">t1</span><span class="p">))</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fit completed on </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">str_time</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Duration time: </span><span class="si">%s</span><span class="s"> s.</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">elapsed</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span>
+                                                      <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">result_panel</span><span class="p">,</span> <span class="n">PlotResultEvent</span><span class="p">(</span><span class="n">result</span><span class="o">=</span><span class="n">result</span><span class="p">))</span>
+        <span class="c"># reset fit_engine if changed by simul_fit</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_gui_engine</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_on_change_engine</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_gui_engine</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_update_fit_button</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span>
+        <span class="n">result</span> <span class="o">=</span> <span class="n">result</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_thread_list</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="k">if</span> <span class="n">page_id</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">page_id</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## fit more than 1 model at the same time</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_mac_sleep</span><span class="p">(</span><span class="mf">0.2</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">index</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">for</span> <span class="n">uid</span> <span class="ow">in</span> <span class="n">page_id</span><span class="p">:</span>
+                <span class="n">res</span> <span class="o">=</span> <span class="n">result</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+                <span class="k">if</span> <span class="n">res</span><span class="o">.</span><span class="n">fitness</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> \
+                    <span class="ow">not</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">fitness</span><span class="p">)</span> <span class="ow">or</span> \
+                    <span class="n">numpy</span><span class="o">.</span><span class="n">any</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">pvec</span> <span class="o">==</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">or</span> \
+                    <span class="ow">not</span> <span class="n">numpy</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">pvec</span><span class="p">)):</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fitting did not converge!!!&quot;</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                             <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                         <span class="n">info</span><span class="o">=</span><span class="s">&quot;warning&quot;</span><span class="p">,</span>
+                                         <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_update_fit_button</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="c">#set the panel when fit result are float not list</span>
+                    <span class="k">if</span> <span class="n">res</span><span class="o">.</span><span class="n">pvec</span><span class="o">.</span><span class="n">__class__</span> <span class="o">==</span> <span class="n">numpy</span><span class="o">.</span><span class="n">float64</span><span class="p">:</span>
+                        <span class="n">pvec</span> <span class="o">=</span> <span class="p">[</span><span class="n">res</span><span class="o">.</span><span class="n">pvec</span><span class="p">]</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">pvec</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">pvec</span>
+                    <span class="k">if</span> <span class="n">res</span><span class="o">.</span><span class="n">stderr</span><span class="o">.</span><span class="n">__class__</span> <span class="o">==</span> <span class="n">numpy</span><span class="o">.</span><span class="n">float64</span><span class="p">:</span>
+                        <span class="n">stderr</span> <span class="o">=</span> <span class="p">[</span><span class="n">res</span><span class="o">.</span><span class="n">stderr</span><span class="p">]</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">stderr</span> <span class="o">=</span> <span class="n">res</span><span class="o">.</span><span class="n">stderr</span>
+                    <span class="n">cpage</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="n">uid</span><span class="p">)</span>
+                    <span class="c"># Make sure we got all results</span>
+                    <span class="c">#(CallAfter is important to MAC)</span>
+                    <span class="k">try</span><span class="p">:</span>
+                        <span class="c">#if res != None:</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">cpage</span><span class="o">.</span><span class="n">onsetValues</span><span class="p">,</span> <span class="n">res</span><span class="o">.</span><span class="n">fitness</span><span class="p">,</span>
+                                     <span class="n">res</span><span class="o">.</span><span class="n">param_list</span><span class="p">,</span>
+                                     <span class="n">pvec</span><span class="p">,</span> <span class="n">stderr</span><span class="p">)</span>
+                        <span class="n">index</span> <span class="o">+=</span> <span class="mi">1</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="n">cpage</span><span class="o">.</span><span class="n">_on_fit_complete</span><span class="p">)</span>
+                    <span class="k">except</span> <span class="ne">KeyboardInterrupt</span><span class="p">:</span>
+                        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Singular point: Fitting Stoped.&quot;</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                              <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span>
+                                                              <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+                    <span class="k">except</span><span class="p">:</span>
+                        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Singular point: Fitting Error occurred.&quot;</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                              <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span>
+                                                              <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+                    
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Fit completed but Following&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; warning occurred: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;warning&quot;</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+           
+    <span class="k">def</span> <span class="nf">_update_fit_button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">page_id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Update Fit button when fit stopped</span>
+<span class="sd">        </span>
+<span class="sd">        : parameter page_id: fitpage where the button is</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">page_id</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&#39;list&#39;</span><span class="p">:</span>
+            <span class="n">page_id</span> <span class="o">=</span> <span class="p">[</span><span class="n">page_id</span><span class="p">]</span>
+        <span class="k">for</span> <span class="n">uid</span> <span class="ow">in</span> <span class="n">page_id</span><span class="p">:</span>
+            <span class="n">page</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="n">uid</span><span class="p">)</span>
+            <span class="n">page</span><span class="o">.</span><span class="n">_on_fit_complete</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_on_show_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">pass</span>
+    
+<div class="viewcode-block" id="Plugin.on_reset_batch_flag"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting.Plugin.on_reset_batch_flag">[docs]</a>    <span class="k">def</span> <span class="nf">on_reset_batch_flag</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set batch_reset_flag</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">menu_item</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">id_reset_flag</span><span class="p">)</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="n">menu_item</span><span class="o">.</span><span class="n">IsChecked</span><span class="p">()</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">menu_item</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_reset_flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">menu_item</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_reset_flag</span> <span class="o">=</span> <span class="bp">False</span>
+        
+        <span class="c">## post a message to status bar</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Set Chain Fitting: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_reset_flag</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+</div>
+    <span class="k">def</span> <span class="nf">_onset_engine_park</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        set engine to park</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_change_engine</span><span class="p">(</span><span class="s">&#39;park&#39;</span><span class="p">)</span>
+       
+    <span class="k">def</span> <span class="nf">_onset_engine_scipy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        set engine to scipy</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_change_engine</span><span class="p">(</span><span class="s">&#39;scipy&#39;</span><span class="p">)</span>
+       
+    <span class="k">def</span> <span class="nf">_onset_engine_bumps</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        set engine to bumps</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_change_engine</span><span class="p">(</span><span class="s">&#39;bumps&#39;</span><span class="p">)</span>
+       
+    <span class="k">def</span> <span class="nf">_on_slicer_event</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Receive a panel as event and send it to guiframe</span>
+<span class="sd">        </span>
+<span class="sd">        :param event: event containing a panel</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">panel</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">new_panel</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">panel</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">slicer_panels</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">panel</span><span class="p">)</span>
+            <span class="c"># Set group ID if available</span>
+            <span class="n">event_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">popup_panel</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">panel</span><span class="p">)</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">uid</span> <span class="o">=</span> <span class="n">event_id</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">mypanels</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">panel</span><span class="p">)</span>
+       
+    <span class="k">def</span> <span class="nf">_onclearslicer</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Clear the boxslicer when close the panel associate with this slicer</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span><span class="o">.</span><span class="n">frame</span><span class="o">.</span><span class="n">GetTitle</span><span class="p">()</span>
+        <span class="k">print</span> <span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="n">name</span>
+        <span class="k">for</span> <span class="n">panel</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">slicer_panels</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">panel</span><span class="o">.</span><span class="n">window_caption</span> <span class="o">==</span> <span class="n">name</span><span class="p">:</span>
+                
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">panels</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">panels</span><span class="p">[</span><span class="n">item</span><span class="p">],</span> <span class="s">&quot;uid&quot;</span><span class="p">):</span>
+                        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">panels</span><span class="p">[</span><span class="n">item</span><span class="p">]</span><span class="o">.</span><span class="n">uid</span> <span class="o">==</span> <span class="n">panel</span><span class="o">.</span><span class="n">base</span><span class="o">.</span><span class="n">uid</span><span class="p">:</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">panels</span><span class="p">[</span><span class="n">item</span><span class="p">]</span><span class="o">.</span><span class="n">onClearSlicer</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+                            <span class="c">#self.parent._mgr.Update()</span>
+                            <span class="k">break</span>
+                <span class="k">break</span>
+    
+    <span class="k">def</span> <span class="nf">_on_change_engine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">engine</span><span class="o">=</span><span class="s">&#39;park&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Allow to select the type of engine to perform fit</span>
+<span class="sd">        </span>
+<span class="sd">        :param engine: the key work of the engine</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## saving fit engine name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span> <span class="o">=</span> <span class="n">engine</span>
+        <span class="c">## change menu item state</span>
+        <span class="k">if</span> <span class="n">engine</span> <span class="o">==</span> <span class="s">&quot;park&quot;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">park_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">scipy_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bumps_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">engine</span> <span class="o">==</span> <span class="s">&quot;scipy&quot;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">park_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">scipy_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bumps_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">park_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">scipy_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">menu1</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bumps_id</span><span class="p">)</span><span class="o">.</span><span class="n">Check</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="c">## post a message to status bar</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Engine set to: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="c">## send the current engine type to fitpanel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">_on_engine_change</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_fit_engine</span><span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">_on_model_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        react to model selection on any combo box or model menu.plot the model  </span>
+<span class="sd">        </span>
+<span class="sd">        :param evt: wx.combobox event</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">model</span> <span class="o">=</span> <span class="n">evt</span><span class="o">.</span><span class="n">model</span>
+        <span class="n">uid</span> <span class="o">=</span> <span class="n">evt</span><span class="o">.</span><span class="n">uid</span>
+        <span class="n">qmin</span> <span class="o">=</span> <span class="n">evt</span><span class="o">.</span><span class="n">qmin</span>
+        <span class="n">qmax</span> <span class="o">=</span> <span class="n">evt</span><span class="o">.</span><span class="n">qmax</span>
+        <span class="n">caption</span> <span class="o">=</span> <span class="n">evt</span><span class="o">.</span><span class="n">caption</span>
+        <span class="n">enable_smearer</span> <span class="o">=</span> <span class="n">evt</span><span class="o">.</span><span class="n">enable_smearer</span>
+        <span class="k">if</span> <span class="n">model</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="n">uid</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="k">return</span>
+        <span class="c"># save the name containing the data name with the appropriate model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_model</span><span class="p">(</span><span class="n">model</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">enable_smearing</span><span class="p">(</span><span class="n">enable_smearer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="n">qmin</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="o">=</span><span class="n">qmax</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">uid</span><span class="p">]</span><span class="o">.</span><span class="n">set_fit_tab_caption</span><span class="p">(</span><span class="n">caption</span><span class="o">=</span><span class="n">caption</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">draw_page</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">batch_page</span><span class="o">.</span><span class="n">draw_page</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_update1D</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">output</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Update the output of plotting model 1D</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Plot updating ... &quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;update&quot;</span><span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">_complete1D</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">page_id</span><span class="p">,</span> <span class="n">elapsed</span><span class="p">,</span> <span class="n">index</span><span class="p">,</span> <span class="n">model</span><span class="p">,</span>
+                    <span class="n">weight</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                    <span class="n">toggle_mode_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                    <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+                    <span class="n">source</span><span class="o">=</span><span class="s">&#39;model&#39;</span><span class="p">,</span> <span class="n">plot_result</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Complete plotting 1D data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">numpy</span><span class="o">.</span><span class="n">nan_to_num</span><span class="p">(</span><span class="n">y</span><span class="p">)</span>
+            
+            <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="n">y</span><span class="p">)</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">dy</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">))</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+            <span class="n">_yaxis</span><span class="p">,</span> <span class="n">_yunit</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">get_yaxis</span><span class="p">()</span>
+            <span class="n">_xaxis</span><span class="p">,</span> <span class="n">_xunit</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">get_xaxis</span><span class="p">()</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">name</span>
+
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+            <span class="k">if</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; &quot;</span> <span class="o">+</span> <span class="n">data</span><span class="o">.</span><span class="n">name</span>
+            <span class="c">#if new_plot.id in self.color_dict:</span>
+            <span class="c">#    new_plot.custom_color = self.color_dict[new_plot.id]</span>
+            <span class="c">#find if this theory was already plotted and replace that plot given</span>
+            <span class="c">#the same id</span>
+            <span class="n">theory_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">get_theory_data</span><span class="p">(</span><span class="n">fid</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+            
+            <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+                <span class="n">data_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">data_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+            
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="s">&quot; [&quot;</span> <span class="o">+</span> <span class="n">data_name</span> <span class="o">+</span><span class="s">&quot;]&quot;</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="n">_xaxis</span><span class="p">,</span> <span class="n">_xunit</span><span class="p">)</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="n">_yaxis</span><span class="p">,</span> <span class="n">_yunit</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">set_theory_data</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                                      <span class="n">fid</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                       <span class="n">state</span><span class="o">=</span><span class="n">state</span><span class="p">)</span>
+            <span class="n">current_pg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span>
+            <span class="n">title</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span>
+            <span class="n">batch_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span><span class="o">.</span><span class="n">batch_on</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">batch_on</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                            <span class="n">title</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">title</span><span class="p">)))</span>
+            <span class="k">elif</span> <span class="n">plot_result</span><span class="p">:</span>
+                <span class="n">top_data_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span>
+                <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">top_data_id</span><span class="p">:</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                            <span class="n">title</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">title</span><span class="p">)))</span>
+            <span class="n">caption</span> <span class="o">=</span> <span class="n">current_pg</span><span class="o">.</span><span class="n">window_caption</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">set_fit_tab_caption</span><span class="p">(</span><span class="n">caption</span><span class="o">=</span><span class="n">caption</span><span class="p">)</span>
+           
+            <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">set_theory_data</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                                      <span class="n">fid</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">toggle_mode_on</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                             <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">group_id</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model2D&quot;</span><span class="p">,</span>
+                                          <span class="n">action</span><span class="o">=</span><span class="s">&quot;Hide&quot;</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">update_chisqr</span><span class="p">:</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="n">current_pg</span><span class="p">,</span>
+                                 <span class="n">Chi2UpdateEvent</span><span class="p">(</span><span class="n">output</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_cal_chisqr</span><span class="p">(</span>
+                                                                <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                                                                <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">,</span>
+                                                                <span class="n">weight</span><span class="o">=</span><span class="n">weight</span><span class="p">,</span>
+                                                            <span class="n">page_id</span><span class="o">=</span><span class="n">page_id</span><span class="p">,</span>
+                                                            <span class="n">index</span><span class="o">=</span><span class="n">index</span><span class="p">)))</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_plot_residuals</span><span class="p">(</span><span class="n">page_id</span><span class="o">=</span><span class="n">page_id</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">,</span>
+                                         <span class="n">index</span><span class="o">=</span><span class="n">index</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="n">weight</span><span class="p">)</span>
+
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Computation  completed!&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">raise</span>
+   
+    <span class="k">def</span> <span class="nf">_update2D</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">output</span><span class="p">,</span> <span class="n">time</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Update the output of plotting model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&quot;Plot </span><span class="se">\</span>
+<span class="s">        #updating ... &quot;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;update&quot;</span><span class="p">))</span>
+        <span class="c">#self.ready_fit()</span>
+  
+    <span class="k">def</span> <span class="nf">_complete2D</span><span class="p">(</span><span class="bp">self</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">model</span><span class="p">,</span> <span class="n">page_id</span><span class="p">,</span> <span class="n">elapsed</span><span class="p">,</span> <span class="n">index</span><span class="p">,</span> <span class="n">qmin</span><span class="p">,</span>
+                <span class="n">qmax</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">toggle_mode_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                     <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="s">&#39;model&#39;</span><span class="p">,</span> <span class="n">plot_result</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Complete get the result of modelthread and create model 2D</span>
+<span class="sd">        that can be plot.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">numpy</span><span class="o">.</span><span class="n">nan_to_num</span><span class="p">(</span><span class="n">image</span><span class="p">)</span>
+        <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data2D</span><span class="p">(</span><span class="n">image</span><span class="o">=</span><span class="n">image</span><span class="p">,</span> <span class="n">err_image</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">err_data</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="s">&#39;2d&#39;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="s">&quot;Analytical model 2D &quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; &quot;</span> <span class="o">+</span> <span class="n">data</span><span class="o">.</span><span class="n">name</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model2D&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">detector</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">detector</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">source</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">qx_data</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">qy_data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">qy_data</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">q_data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">q_data</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">mask</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">mask</span>
+        <span class="c">## plot boundaries</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">ymin</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">ymin</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">ymax</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">ymax</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xmin</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">xmin</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xmax</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">xmax</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">title</span>
+        
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+            <span class="n">data_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">data_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span> <span class="o">+</span> <span class="s">&#39;2d&#39;</span>
+
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">title</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="s">&quot;Model2D for </span><span class="si">%s</span><span class="s"> &quot;</span><span class="o">%</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="n">data_name</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="s">&quot; [&quot;</span> <span class="o">+</span> \
+                                    <span class="n">data_name</span> <span class="o">+</span> <span class="s">&quot;]&quot;</span>
+        <span class="n">theory_data</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">new_plot</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">set_theory_data</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">theory_data</span><span class="p">,</span>
+                                                  <span class="n">fid</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span>
+                                       <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                       <span class="n">state</span><span class="o">=</span><span class="n">state</span><span class="p">)</span>
+        <span class="n">current_pg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">source</span> <span class="o">==</span> <span class="s">&#39;fit&#39;</span> <span class="ow">and</span> <span class="n">plot_result</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                               <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">))</span>
+        <span class="k">if</span> <span class="n">toggle_mode_on</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                             <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">group_id</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; Model1D&quot;</span><span class="p">,</span>
+                                               <span class="n">action</span><span class="o">=</span><span class="s">&quot;Hide&quot;</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># Chisqr in fitpage</span>
+            <span class="k">if</span> <span class="n">update_chisqr</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="n">current_pg</span><span class="p">,</span>
+                             <span class="n">Chi2UpdateEvent</span><span class="p">(</span><span class="n">output</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_cal_chisqr</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                                                                    <span class="n">weight</span><span class="o">=</span><span class="n">weight</span><span class="p">,</span>
+                                                                    <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">,</span>
+                                                         <span class="n">page_id</span><span class="o">=</span><span class="n">page_id</span><span class="p">,</span>
+                                                         <span class="n">index</span><span class="o">=</span><span class="n">index</span><span class="p">)))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_plot_residuals</span><span class="p">(</span><span class="n">page_id</span><span class="o">=</span><span class="n">page_id</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">,</span>
+                                      <span class="n">index</span><span class="o">=</span><span class="n">index</span><span class="p">,</span> <span class="n">weight</span><span class="o">=</span><span class="n">weight</span><span class="p">)</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Computation  completed!&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+    
+    <span class="k">def</span> <span class="nf">_draw_model2D</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">,</span> <span class="n">page_id</span><span class="p">,</span> <span class="n">qmin</span><span class="p">,</span>
+                      <span class="n">qmax</span><span class="p">,</span>
+                      <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">smearer</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                      <span class="n">description</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">enable2D</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+                      <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                      <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                      <span class="n">weight</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                      <span class="n">toggle_mode_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+                       <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="s">&#39;model&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        draw model in 2D</span>
+<span class="sd">        </span>
+<span class="sd">        :param model: instance of the model to draw</span>
+<span class="sd">        :param description: the description of the model</span>
+<span class="sd">        :param enable2D: when True allows to draw model 2D</span>
+<span class="sd">        :param qmin: the minimum value to  draw model 2D</span>
+<span class="sd">        :param qmax: the maximum value to draw model 2D</span>
+<span class="sd">        :param qstep: the number of division of Qx and Qy of the model to draw</span>
+<span class="sd">            </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">enable2D</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="kn">from</span> <span class="nn">model_thread</span> <span class="kn">import</span> <span class="n">Calc2D</span>
+            <span class="c">## If a thread is already started, stop it</span>
+            <span class="k">if</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">calc_2D</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">calc_2D</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">calc_2D</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
+                <span class="c">## stop just raises a flag to tell the thread to kill</span>
+                <span class="c">## itself -- see the fix in Calc1D implemented to fix</span>
+                <span class="c">## an actual problem.  Seems the fix should also go here</span>
+                <span class="c">## and may be the cause of other noted instabilities</span>
+                <span class="c">##</span>
+                <span class="c">##    -PDB August 12, 2014 </span>
+                <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">calc_2D</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+                    <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.1</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">calc_2D</span> <span class="o">=</span> <span class="n">Calc2D</span><span class="p">(</span><span class="n">model</span><span class="o">=</span><span class="n">model</span><span class="p">,</span>
+                                    <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                                    <span class="n">page_id</span><span class="o">=</span><span class="n">page_id</span><span class="p">,</span>
+                                    <span class="n">smearer</span><span class="o">=</span><span class="n">smearer</span><span class="p">,</span>
+                                    <span class="n">qmin</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span>
+                                    <span class="n">qmax</span><span class="o">=</span><span class="n">qmax</span><span class="p">,</span>
+                                    <span class="n">weight</span><span class="o">=</span><span class="n">weight</span><span class="p">,</span> 
+                                    <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">,</span>
+                                    <span class="n">toggle_mode_on</span><span class="o">=</span><span class="n">toggle_mode_on</span><span class="p">,</span>
+                                    <span class="n">state</span><span class="o">=</span><span class="n">state</span><span class="p">,</span>
+                                    <span class="n">completefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_complete2D</span><span class="p">,</span>
+                                    <span class="n">update_chisqr</span><span class="o">=</span><span class="n">update_chisqr</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">calc_2D</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">raise</span>
+
+    <span class="k">def</span> <span class="nf">_draw_model1D</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">,</span> <span class="n">page_id</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span>
+                      <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="p">,</span> <span class="n">smearer</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                <span class="n">weight</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                <span class="n">toggle_mode_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="s">&#39;model&#39;</span><span class="p">,</span>
+                <span class="n">enable1D</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw model 1D from loaded data1D</span>
+<span class="sd">        </span>
+<span class="sd">        :param data: loaded data</span>
+<span class="sd">        :param model: the model to plot</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">enable1D</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="kn">from</span> <span class="nn">model_thread</span> <span class="kn">import</span> <span class="n">Calc1D</span>
+            <span class="c">## If a thread is already started, stop it</span>
+            <span class="k">if</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">calc_1D</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">calc_1D</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">calc_1D</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
+                <span class="c">## stop just raises the flag -- the thread is supposed to </span>
+                <span class="c">## then kill itself but cannot.  Paul Kienzle came up with</span>
+                <span class="c">## this fix to prevent threads from stepping on each other</span>
+                <span class="c">## which was causing a simple custom model to crash Sasview.</span>
+                <span class="c">## We still don&#39;t know why the fit sometimes lauched a second</span>
+                <span class="c">## thread -- something which should also be investigated.</span>
+                <span class="c">## The thread approach was implemented in order to be able</span>
+                <span class="c">## to lauch a computation in a separate thread from the GUI so</span>
+                <span class="c">## that the GUI can still respond to user input including</span>
+                <span class="c">## a request to stop the computation.</span>
+                <span class="c">## It seems thus that the whole thread approach used here</span>
+                <span class="c">## May need rethinking  </span>
+                <span class="c">##</span>
+                <span class="c">##    -PDB August 12, 2014                  </span>
+                <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">calc_1D</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+                    <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.1</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">calc_1D</span> <span class="o">=</span> <span class="n">Calc1D</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                                  <span class="n">model</span><span class="o">=</span><span class="n">model</span><span class="p">,</span>
+                                  <span class="n">page_id</span><span class="o">=</span><span class="n">page_id</span><span class="p">,</span> 
+                                  <span class="n">qmin</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span>
+                                  <span class="n">qmax</span><span class="o">=</span><span class="n">qmax</span><span class="p">,</span>
+                                  <span class="n">smearer</span><span class="o">=</span><span class="n">smearer</span><span class="p">,</span>
+                                  <span class="n">state</span><span class="o">=</span><span class="n">state</span><span class="p">,</span>
+                                  <span class="n">weight</span><span class="o">=</span><span class="n">weight</span><span class="p">,</span>
+                                  <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">,</span>
+                                  <span class="n">toggle_mode_on</span><span class="o">=</span><span class="n">toggle_mode_on</span><span class="p">,</span>
+                                  <span class="n">completefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_complete1D</span><span class="p">,</span>
+                                  <span class="c">#updatefn = self._update1D,</span>
+                                  <span class="n">update_chisqr</span><span class="o">=</span><span class="n">update_chisqr</span><span class="p">,</span>
+                                  <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">calc_1D</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Error occurred when drawing </span><span class="si">%s</span><span class="s"> Model 1D: &quot;</span> <span class="o">%</span> <span class="n">model</span><span class="o">.</span><span class="n">name</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+    
+    <span class="k">def</span> <span class="nf">_cal_chisqr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">page_id</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">weight</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">index</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get handy Chisqr using the output from draw1D and 2D, </span>
+<span class="sd">        instead of calling expansive CalcChisqr in guithread</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">data_copy</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c"># default chisqr</span>
+        <span class="n">chisqr</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#to compute chisq make sure data has valid data</span>
+        <span class="c"># return None if data == None</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">check_data_validity</span><span class="p">(</span><span class="n">data_copy</span><span class="p">)</span> <span class="ow">or</span> <span class="n">data_copy</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">chisqr</span>
+
+        <span class="c"># Get data: data I, theory I, and data dI in order</span>
+        <span class="k">if</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">index</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">index</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data_copy</span><span class="o">.</span><span class="n">data</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">weight</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">data_copy</span><span class="o">.</span><span class="n">err_data</span> <span class="o">=</span> <span class="n">weight</span>
+            <span class="c"># get rid of zero error points</span>
+            <span class="n">index</span> <span class="o">=</span> <span class="n">index</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">data_copy</span><span class="o">.</span><span class="n">err_data</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="n">index</span> <span class="o">=</span> <span class="n">index</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">data_copy</span><span class="o">.</span><span class="n">data</span><span class="p">))</span>
+            <span class="n">fn</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+            <span class="n">theory_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">get_theory_data</span><span class="p">(</span><span class="n">fid</span><span class="o">=</span><span class="n">data_copy</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">theory_data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span> <span class="n">chisqr</span>
+            <span class="n">gn</span> <span class="o">=</span> <span class="n">theory_data</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+            <span class="n">en</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">err_data</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># 1 d theory from model_thread is only in the range of index</span>
+            <span class="k">if</span> <span class="n">index</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span> 
+                <span class="n">index</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data_copy</span><span class="o">.</span><span class="n">y</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="nb">bool</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">weight</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">data_copy</span><span class="o">.</span><span class="n">dy</span> <span class="o">=</span> <span class="n">weight</span>
+            <span class="k">if</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">dy</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">dy</span> <span class="o">==</span> <span class="p">[]:</span>
+                <span class="n">dy</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data_copy</span><span class="o">.</span><span class="n">y</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="c">## Set consitently w/AbstractFitengine:</span>
+                <span class="c"># But this should be corrected later.</span>
+                <span class="n">dy</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">data_copy</span><span class="o">.</span><span class="n">dy</span><span class="p">)</span>
+                <span class="n">dy</span><span class="p">[</span><span class="n">dy</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span>
+            <span class="n">fn</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">y</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+            
+            <span class="n">theory_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">get_theory_data</span><span class="p">(</span><span class="n">fid</span><span class="o">=</span><span class="n">data_copy</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">theory_data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">return</span> <span class="n">chisqr</span>
+            <span class="n">gn</span> <span class="o">=</span> <span class="n">theory_data</span><span class="o">.</span><span class="n">y</span>
+            <span class="n">en</span> <span class="o">=</span> <span class="n">dy</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+        
+        <span class="c"># residual</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">res</span> <span class="o">=</span> <span class="p">(</span><span class="n">fn</span> <span class="o">-</span> <span class="n">gn</span><span class="p">)</span> <span class="o">/</span> <span class="n">en</span>
+        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
+            <span class="k">print</span> <span class="s">&quot;Unmatch lengths </span><span class="si">%s</span><span class="s">, </span><span class="si">%s</span><span class="s">, </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">fn</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">gn</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">en</span><span class="p">))</span>
+            <span class="k">return</span>
+        
+        <span class="n">residuals</span> <span class="o">=</span> <span class="n">res</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">res</span><span class="p">)]</span>
+        <span class="c"># get chisqr only w/finite</span>
+        <span class="n">chisqr</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">average</span><span class="p">(</span><span class="n">residuals</span> <span class="o">*</span> <span class="n">residuals</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_plot_residuals</span><span class="p">(</span><span class="n">page_id</span><span class="o">=</span><span class="n">page_id</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data_copy</span><span class="p">,</span>
+                             <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">,</span>
+                             <span class="n">weight</span><span class="o">=</span><span class="n">weight</span><span class="p">,</span> <span class="n">index</span><span class="o">=</span><span class="n">index</span><span class="p">)</span>
+        
+        <span class="k">return</span> <span class="n">chisqr</span>
+    
+    <span class="k">def</span> <span class="nf">_plot_residuals</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">page_id</span><span class="p">,</span> <span class="n">weight</span><span class="p">,</span> <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                        <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">index</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Plot the residuals</span>
+<span class="sd">        </span>
+<span class="sd">        :param data: data</span>
+<span class="sd">        :param index: index array (bool)</span>
+<span class="sd">        : Note: this is different from the residuals in cal_chisqr()</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data_copy</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="c"># Get data: data I, theory I, and data dI in order</span>
+        <span class="k">if</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+            <span class="c"># build residuals</span>
+            <span class="n">residuals</span> <span class="o">=</span> <span class="n">Data2D</span><span class="p">()</span>
+            <span class="c">#residuals.copy_from_datainfo(data)</span>
+            <span class="c"># Not for trunk the line below, instead use the line above</span>
+            <span class="n">data_copy</span><span class="o">.</span><span class="n">clone_without_data</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data_copy</span><span class="o">.</span><span class="n">data</span><span class="p">),</span> <span class="n">residuals</span><span class="p">)</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">fn</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">data</span>
+            <span class="n">theory_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">get_theory_data</span><span class="p">(</span><span class="n">fid</span><span class="o">=</span><span class="n">data_copy</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+            <span class="n">gn</span> <span class="o">=</span> <span class="n">theory_data</span><span class="o">.</span><span class="n">data</span>
+            <span class="k">if</span> <span class="n">weight</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">en</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">err_data</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">en</span> <span class="o">=</span> <span class="n">weight</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="p">(</span><span class="n">fn</span> <span class="o">-</span> <span class="n">gn</span><span class="p">)</span> <span class="o">/</span> <span class="n">en</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">qx_data</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">qy_data</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">qy_data</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">q_data</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">q_data</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">err_data</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">residuals</span><span class="o">.</span><span class="n">data</span><span class="p">))</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">xmin</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">residuals</span><span class="o">.</span><span class="n">qx_data</span><span class="p">)</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">xmax</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">residuals</span><span class="o">.</span><span class="n">qx_data</span><span class="p">)</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">ymin</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">residuals</span><span class="o">.</span><span class="n">qy_data</span><span class="p">)</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">ymax</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">residuals</span><span class="o">.</span><span class="n">qy_data</span><span class="p">)</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">q_data</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">q_data</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">mask</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">mask</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">scale</span> <span class="o">=</span> <span class="s">&#39;linear&#39;</span>
+            <span class="c"># check the lengths</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">residuals</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">residuals</span><span class="o">.</span><span class="n">q_data</span><span class="p">):</span>
+                <span class="k">return</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># 1 d theory from model_thread is only in the range of index</span>
+            <span class="k">if</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">dy</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">dy</span> <span class="o">==</span> <span class="p">[]:</span>
+                <span class="n">dy</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data_copy</span><span class="o">.</span><span class="n">y</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">weight</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">dy</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data_copy</span><span class="o">.</span><span class="n">y</span><span class="p">))</span>
+                <span class="c">## Set consitently w/AbstractFitengine:</span>
+                <span class="c">## But this should be corrected later.</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">dy</span> <span class="o">=</span> <span class="n">weight</span>
+                <span class="n">dy</span><span class="p">[</span><span class="n">dy</span> <span class="o">==</span> <span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span>
+            <span class="n">fn</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">y</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+            <span class="n">theory_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">get_theory_data</span><span class="p">(</span><span class="n">fid</span><span class="o">=</span><span class="n">data_copy</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+            <span class="n">gn</span> <span class="o">=</span> <span class="n">theory_data</span><span class="o">.</span><span class="n">y</span>
+            <span class="n">en</span> <span class="o">=</span> <span class="n">dy</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+            <span class="c"># build residuals</span>
+            <span class="n">residuals</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">()</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">residuals</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="p">(</span><span class="n">fn</span> <span class="o">-</span> <span class="n">gn</span><span class="p">)</span> <span class="o">/</span> <span class="n">en</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;ResidualPlot Error: different # of data points in theory&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+                <span class="n">residuals</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="p">(</span><span class="n">fn</span> <span class="o">-</span> <span class="n">gn</span><span class="p">[</span><span class="n">index</span><span class="p">])</span> <span class="o">/</span> <span class="n">en</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">data_copy</span><span class="o">.</span><span class="n">x</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">dy</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">residuals</span><span class="o">.</span><span class="n">y</span><span class="p">))</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">dx</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">ytransform</span> <span class="o">=</span> <span class="s">&#39;y&#39;</span>
+            <span class="c"># For latter scale changes </span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Q} &#39;</span><span class="p">,</span> <span class="s">&#39;A^{-1}&#39;</span><span class="p">)</span>
+            <span class="n">residuals</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\\</span><span class="s">rm{Residuals} &#39;</span><span class="p">,</span> <span class="s">&#39;normalized&#39;</span><span class="p">)</span>
+        <span class="n">theory_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">theory_data</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">()[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="n">new_plot</span> <span class="o">=</span> <span class="n">residuals</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;Residuals for &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">theory_name</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;[&quot;</span> <span class="o">+</span>\
+                        <span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="o">+</span><span class="s">&quot;]&quot;</span>
+        <span class="c">## allow to highlight data when plotted</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">interactive</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c">## when 2 data have the same id override the 1 st plotted</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="s">&quot;res&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">data_copy</span><span class="o">.</span><span class="n">id</span><span class="p">)</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">theory_name</span><span class="p">)</span>
+        <span class="c">##group_id specify on which panel to plot this data</span>
+        <span class="n">group_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">get_graph_id</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">group_id</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">group_id</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="s">&quot;res&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">group_id</span><span class="p">)</span>
+        <span class="c">#new_plot.is_data = True</span>
+        <span class="c">##post data to plot</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span><span class="o">.</span><span class="n">set_residuals</span><span class="p">(</span><span class="n">residuals</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                                <span class="n">fid</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">)</span>
+        <span class="n">batch_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_panel</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="n">page_id</span><span class="p">)</span><span class="o">.</span><span class="n">batch_on</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">batch_on</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">))</span></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/fitting_widgets.html
===================================================================
--- _modules/sas/perspectives/fitting/fitting_widgets.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/fitting_widgets.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,282 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.fitting_widgets &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.fitting_widgets</h1><div class="highlight"><pre>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation.</span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">from</span> <span class="nn">wx.lib.scrolledpanel</span> <span class="kn">import</span> <span class="n">ScrolledPanel</span>
+
+<span class="n">MAX_NBR_DATA</span> <span class="o">=</span> <span class="mi">4</span>
+<span class="n">WIDTH</span> <span class="o">=</span> <span class="mi">430</span>
+<span class="n">HEIGHT</span> <span class="o">=</span> <span class="mi">350</span>
+
+
+<span class="k">class</span> <span class="nc">DialogPanel</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">):</span>
+<div class="viewcode-block" id="DialogPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting_widgets.DialogPanel">[docs]</a>    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        
+        
+<span class="k">class</span> <span class="nc">BatchDataDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span></div>
+<div class="viewcode-block" id="BatchDataDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting_widgets.BatchDataDialog">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    The current design of Batch  fit allows only of type of data in the data</span>
+<span class="sd">    set. This allows the user to make a quick selection of the type of data</span>
+<span class="sd">    to use in fit tab.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSize</span><span class="p">((</span><span class="n">WIDTH</span><span class="p">,</span> <span class="n">HEIGHT</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_1d_selected</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_2d_selected</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+   
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw the content of the current dialog window</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">vbox</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>
+        <span class="n">box_description</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="s">&quot;Hint&quot;</span><span class="p">))</span>
+        <span class="n">hint_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">box_description</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">selection_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
+        <span class="n">button_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_1d_selected</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Data1D&#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">RB_GROUP</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_2d_selected</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Data2D&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_1d_selected</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_2d_selected</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="n">button_cancel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span> <span class="s">&quot;Cancel&quot;</span><span class="p">)</span>
+        <span class="n">button_OK</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">,</span> <span class="s">&quot;Ok&quot;</span><span class="p">)</span>
+        <span class="n">button_OK</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        <span class="n">hint</span> <span class="o">=</span> <span class="s">&quot;Selected Data set contains both 1D and 2D Data.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">hint</span> <span class="o">+=</span> <span class="s">&quot;Please select on type of analysis before proceeding.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">hint_sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">hint</span><span class="p">))</span>
+        <span class="c">#draw area containing radio buttons</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">selection_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_1d_selected</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span>
+                           <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">selection_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_2d_selected</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span>
+                           <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="c">#contruction the sizer contaning button</span>
+        <span class="n">button_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">button_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_cancel</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">button_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_OK</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">hint_sizer</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">selection_sizer</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">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">vbox</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">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">EXPAND</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_sizer</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">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="BatchDataDialog.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting_widgets.BatchDataDialog.get_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return 1 if  user requested Data1D , 2 if user requested Data2D</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_1d_selected</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="k">return</span> <span class="mi">1</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="mi">2</span>
+
+
+<span class="k">class</span> <span class="nc">DataDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span></div></div>
+<div class="viewcode-block" id="DataDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting_widgets.DataDialog">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Allow file selection at loading time</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span>
+                 <span class="n">nb_data</span><span class="o">=</span><span class="n">MAX_NBR_DATA</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="s">&quot;Data Selection&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_max_data</span> <span class="o">=</span> <span class="n">nb_data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_nb_selected_data</span> <span class="o">=</span> <span class="n">nb_data</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSize</span><span class="p">((</span><span class="n">WIDTH</span><span class="p">,</span> <span class="n">HEIGHT</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_of_ctrl</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">data_list</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">select_data_text</span> <span class="o">=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> Data selected.</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_nb_selected_data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data_text_ctrl</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">select_data_text</span><span class="p">))</span>
+                               
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data_text_ctrl</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;blue&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_choice_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_panel</span> <span class="o">=</span> <span class="n">DialogPanel</span><span class="p">(</span><span class="bp">self</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">RAISED_BORDER</span><span class="p">,</span>
+                               <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">WIDTH</span><span class="o">-</span><span class="mi">20</span><span class="p">,</span> <span class="n">HEIGHT</span><span class="o">/</span><span class="mi">3</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">__do_layout</span><span class="p">(</span><span class="n">data_list</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="n">text</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">__do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        layout the dialog</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">data_list</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span> <span class="o">&lt;=</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="c">#add text</span>
+        <span class="k">if</span> <span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="n">text</span> <span class="o">=</span> <span class="s">&quot;Fitting: We recommend that you selected&quot;</span>
+            <span class="n">text</span> <span class="o">+=</span> <span class="s">&quot; no more than &#39;</span><span class="si">%s</span><span class="s">&#39; data</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_max_data</span><span class="p">)</span>
+            <span class="n">text</span> <span class="o">+=</span> <span class="s">&quot;for adequate plot display size. </span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">text</span> <span class="o">+=</span> <span class="s">&quot;unchecked data won&#39;t be send to fitting . </span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">text_ctrl</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">text</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">text_ctrl</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">data_count</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)):</span>
+            <span class="n">data_count</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">cb</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="bp">self</span><span class="o">.</span><span class="n">_panel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">data_list</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</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="bp">self</span><span class="p">,</span> <span class="n">cb</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_count_selected_data</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">data_count</span> <span class="o">&lt;=</span> <span class="n">MAX_NBR_DATA</span><span class="p">:</span>
+                <span class="n">cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">list_of_ctrl</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">cb</span><span class="p">,</span> <span class="n">data_list</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_choice_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">cb</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span>
+                           <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+            <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_panel</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_choice_sizer</span><span class="p">)</span>
+        <span class="c">#add sizer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">button_cancel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span> <span class="s">&quot;Cancel&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_cancel</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">button_OK</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">,</span> <span class="s">&quot;Ok&quot;</span><span class="p">)</span>
+        <span class="n">button_OK</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_OK</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">static_line</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_panel</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_data_text_ctrl</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">static_line</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">EXPAND</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="DataDialog.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.fitting_widgets.DataDialog.get_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the selected data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">temp</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">list_of_ctrl</span><span class="p">:</span>
+            <span class="n">cb</span><span class="p">,</span> <span class="n">data</span> <span class="o">=</span> <span class="n">item</span>
+            <span class="k">if</span> <span class="n">cb</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="n">temp</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">temp</span>
+    
+    <span class="k">def</span> <span class="nf">_count_selected_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        count selected data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_nb_selected_data</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_nb_selected_data</span> <span class="o">-=</span> <span class="mi">1</span>
+        <span class="n">select_data_text</span> <span class="o">=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s"> Data selected.</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_nb_selected_data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data_text_ctrl</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">select_data_text</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_nb_selected_data</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_max_data</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_data_text_ctrl</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;blue&#39;</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_data_text_ctrl</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;red&#39;</span><span class="p">)</span>
+</pre></div></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/ftol_dialog.html
===================================================================
--- _modules/sas/perspectives/fitting/ftol_dialog.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/ftol_dialog.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,199 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.ftol_dialog &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.ftol_dialog</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Dialog to set ftol for Scipy</span>
+
+<span class="sd">    ftol(float): Relative error desired in the sum of squares.</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation.</span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="c"># default ftol</span>
+<span class="n">F_TOL</span> <span class="o">=</span> <span class="mf">1.49012e-08</span>
+<span class="n">SAS_F_TOL</span> <span class="o">=</span> <span class="mf">5e-05</span>
+
+<span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">270</span>
+<span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">265</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">245</span>
+    
+<div class="viewcode-block" id="ChangeFtol"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.ftol_dialog.ChangeFtol">[docs]</a><span class="k">class</span> <span class="nc">ChangeFtol</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Dialog to select ftol</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">base</span><span class="p">,</span> <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;FTolerance&quot;</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span>
+                           <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">))</span>
+        <span class="c"># font size</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="c"># build layout</span>
+        <span class="n">vbox</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>
+        <span class="n">title_text</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span> <span class="n">label</span><span class="o">=</span><span class="s">&#39;FTol selection (Leastsq)&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">default_bt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;SasView Default (5e-05)&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">15</span><span class="p">,</span> <span class="mi">30</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">RB_GROUP</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">default_bt</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">default_bt</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnFtolSelection</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sci_default_bt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Scipy Default (1.49012e-08)&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">15</span><span class="p">,</span> <span class="mi">55</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sci_default_bt</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sci_default_bt</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnFtolSelection</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_bt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;1e-06&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">15</span><span class="p">,</span> <span class="mi">80</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_bt</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_bt</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnFtolSelection</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mid_bt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;1e-05&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">15</span><span class="p">,</span> <span class="mi">105</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mid_bt</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mid_bt</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnFtolSelection</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_bt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;1e-04&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">15</span><span class="p">,</span> <span class="mi">130</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_bt</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_bt</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnFtolSelection</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">custom_bt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Custom&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">15</span><span class="p">,</span> <span class="mi">155</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">custom_bt</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">custom_bt</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnFtolSelection</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">custombox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">95</span><span class="p">,</span> <span class="mi">155</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">custombox</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        
+        <span class="n">hbox</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>
+        <span class="n">okButton</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">,</span> <span class="s">&#39;Set&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">70</span><span class="p">,</span> <span class="mi">30</span><span class="p">))</span>
+        <span class="n">closeButton</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span> <span class="s">&#39;Cancel&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">70</span><span class="p">,</span> <span class="mi">30</span><span class="p">))</span>
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">okButton</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">closeButton</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">title_text</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</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">default_bt</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sci_default_bt</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">high_bt</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mid_bt</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">low_bt</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">custom_bt</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">custombox</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">LEFT</span><span class="p">,</span> <span class="mi">60</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">hbox</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</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+
+<div class="viewcode-block" id="ChangeFtol.OnFtolSelection"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.ftol_dialog.ChangeFtol.OnFtolSelection">[docs]</a>    <span class="k">def</span> <span class="nf">OnFtolSelection</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">           Changes the ftol on selection of the radio button</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">custombox</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">custom_bt</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        </div>
+<div class="viewcode-block" id="ChangeFtol.get_ftol"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.ftol_dialog.ChangeFtol.get_ftol">[docs]</a>    <span class="k">def</span> <span class="nf">get_ftol</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Get the ftol value</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">default_bt</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="k">return</span> <span class="n">SAS_F_TOL</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">sci_default_bt</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="k">return</span> <span class="n">F_TOL</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">low_bt</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="k">return</span> <span class="mf">1.0e-4</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">mid_bt</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="k">return</span> <span class="mf">1.0e-5</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">high_bt</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="k">return</span> <span class="mf">1.0e-6</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">custom_bt</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">custombox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">return</span> <span class="n">SAS_F_TOL</span></div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/help_panel.html
===================================================================
--- _modules/sas/perspectives/fitting/help_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/help_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,254 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.help_panel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.help_panel</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Help dialog</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">wx.html</span> <span class="kn">as</span> <span class="nn">html</span>
+<span class="kn">from</span> <span class="nn">wx.lib.splitter</span> <span class="kn">import</span> <span class="n">MultiSplitterWindow</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">from</span> <span class="nn">wx.lib.scrolledpanel</span> <span class="kn">import</span> <span class="n">ScrolledPanel</span>
+
+<div class="viewcode-block" id="HelpPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.help_panel.HelpPanel">[docs]</a><span class="k">class</span> <span class="nc">HelpPanel</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">):</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+
+</div>
+<div class="viewcode-block" id="HelpWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.help_panel.HelpWindow">[docs]</a><span class="k">class</span> <span class="nc">HelpWindow</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&#39;Fitting Help&#39;</span><span class="p">,</span> <span class="n">pageToOpen</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">850</span><span class="p">,</span> <span class="mi">540</span><span class="p">)):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        contains help info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="n">title</span><span class="p">)</span> 
+        <span class="kn">from</span> <span class="nn">sas.perspectives.fitting</span> <span class="kn">import</span> <span class="n">get_data_path</span> <span class="k">as</span> <span class="n">fit_path</span>
+        <span class="n">fitting_path</span> <span class="o">=</span> <span class="n">fit_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&#39;media&#39;</span><span class="p">)</span>
+        <span class="n">ico_file</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">fitting_path</span><span class="p">,</span> <span class="s">&#39;ball.ico&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">ico_file</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">SetIcon</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Icon</span><span class="p">(</span><span class="n">ico_file</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">BITMAP_TYPE_ICO</span><span class="p">))</span>
+        <span class="n">splitter</span> <span class="o">=</span> <span class="n">MultiSplitterWindow</span><span class="p">(</span><span class="bp">self</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">SP_LIVE_UPDATE</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rpanel</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">splitter</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lpanel</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">splitter</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">BORDER_SUNKEN</span><span class="p">)</span>
+        
+        <span class="n">vbox</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>
+        <span class="n">header</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="bp">self</span><span class="o">.</span><span class="n">rpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">header</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;#6666FF&#39;</span><span class="p">)</span>
+        <span class="n">header</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;WHITE&#39;</span><span class="p">)</span>
+        <span class="n">hbox</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>
+        <span class="n">st</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">header</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Contents&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="n">font</span> <span class="o">=</span> <span class="n">st</span><span class="o">.</span><span class="n">GetFont</span><span class="p">()</span>
+        <span class="n">font</span><span class="o">.</span><span class="n">SetPointSize</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">st</span><span class="o">.</span><span class="n">SetFont</span><span class="p">(</span><span class="n">font</span><span class="p">)</span>
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">st</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">header</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">hbox</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">header</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">EXPAND</span><span class="p">)</span>
+       
+        <span class="n">vboxl</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>
+        <span class="n">headerl</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="bp">self</span><span class="o">.</span><span class="n">lpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+       
+        <span class="n">headerl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;#6666FF&#39;</span><span class="p">)</span>
+        <span class="n">headerl</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;WHITE&#39;</span><span class="p">)</span>
+        <span class="n">hboxl</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>
+        <span class="n">lst</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">headerl</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Menu&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="n">fontl</span> <span class="o">=</span> <span class="n">lst</span><span class="o">.</span><span class="n">GetFont</span><span class="p">()</span>
+        <span class="n">fontl</span><span class="o">.</span><span class="n">SetPointSize</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">lst</span><span class="o">.</span><span class="n">SetFont</span><span class="p">(</span><span class="n">fontl</span><span class="p">)</span>
+        <span class="n">hboxl</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">lst</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">headerl</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">hboxl</span><span class="p">)</span>
+        <span class="n">vboxl</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">headerl</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">EXPAND</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lhelp</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlWindow</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">lpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">NO_BORDER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlWindow</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">rpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">NO_BORDER</span><span class="p">,</span> 
+                                     <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">500</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+
+        <span class="c"># get the media path</span>
+        <span class="k">if</span> <span class="n">pageToOpen</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">pageToOpen</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="kn">from</span> <span class="nn">sas.models</span> <span class="kn">import</span> <span class="n">get_data_path</span> <span class="k">as</span> <span class="n">model_path</span>
+            <span class="c"># Get models help model_function path</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">model_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&#39;media&#39;</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="s">&quot;model_functions.html&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">path_pd</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="s">&quot;pd_help.html&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">path_sm</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="s">&quot;smear_computation.html&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">path_mag</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="s">&quot;polar_mag_help.html&quot;</span><span class="p">)</span>
+        
+        <span class="n">_html_file</span> <span class="o">=</span> <span class="p">[(</span><span class="s">&quot;load_data_help.html&quot;</span><span class="p">,</span> <span class="s">&quot;Load a File&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;single_fit_help.html&quot;</span><span class="p">,</span> <span class="s">&quot;Single Fit&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;simultaneous_fit_help.html&quot;</span><span class="p">,</span> <span class="s">&quot;Simultaneous Fit&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;batch_help.html&quot;</span><span class="p">,</span> <span class="s">&quot;Batch Fit&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;model_use_help.html&quot;</span><span class="p">,</span> <span class="s">&quot;Model Selection&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;category_manager_help.html&quot;</span><span class="p">,</span> <span class="s">&quot;Model Category Manager&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">path</span><span class="p">,</span> <span class="s">&quot;Model Functions&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;model_editor_help.html&quot;</span><span class="p">,</span> <span class="s">&quot;Custom Model Editor&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">path_pd</span><span class="p">,</span> <span class="s">&quot;Polydispersion Distributions&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">path_sm</span><span class="p">,</span> <span class="s">&quot;Smear Computation&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">path_mag</span><span class="p">,</span> <span class="s">&quot;Polarization/Magnetic Scattering&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;key_help.html&quot;</span><span class="p">,</span> <span class="s">&quot;Key Combination&quot;</span><span class="p">),</span>
+                      <span class="p">(</span><span class="s">&quot;status_bar_help.html&quot;</span><span class="p">,</span> <span class="s">&quot;Status Bar Help&quot;</span><span class="p">),</span>
+                      <span class="p">]</span>
+ 
+        <span class="n">page1</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;&lt;html&gt;</span>
+<span class="s">            &lt;body&gt;</span>
+<span class="s">             &lt;p&gt;Select topic on Menu&lt;/p&gt;</span>
+<span class="s">            &lt;/body&gt;</span>
+<span class="s">            &lt;/html&gt;&quot;&quot;&quot;</span>
+            
+        <span class="n">page</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;&lt;html&gt;</span>
+<span class="s">            &lt;body&gt;</span>
+<span class="s">            &lt;ul&gt;</span>
+<span class="s">            &quot;&quot;&quot;</span>
+            
+        <span class="k">for</span> <span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">title</span><span class="p">)</span> <span class="ow">in</span> <span class="n">_html_file</span><span class="p">:</span>
+            <span class="n">pp</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">fitting_path</span><span class="p">,</span> <span class="n">p</span><span class="p">)</span>
+            <span class="n">page</span> <span class="o">+=</span> <span class="s">&quot;&quot;&quot;&lt;li&gt;&lt;a href =&quot;</span><span class="si">%s</span><span class="s">&quot; target=&quot;showframe&quot;&gt;</span><span class="si">%s</span><span class="s">&lt;/a&gt;&lt;br&gt;&lt;/li&gt;&quot;&quot;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">pp</span><span class="p">,</span> <span class="n">title</span><span class="p">)</span>
+        <span class="n">page</span> <span class="o">+=</span> <span class="s">&quot;&quot;&quot;&lt;/ul&gt;</span>
+<span class="s">                    &lt;/body&gt;</span>
+<span class="s">                    &lt;/html&gt;</span>
+<span class="s">                &quot;&quot;&quot;</span>
+                
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">SetPage</span><span class="p">(</span><span class="n">page1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lhelp</span><span class="o">.</span><span class="n">SetPage</span><span class="p">(</span><span class="n">page</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lhelp</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">html</span><span class="o">.</span><span class="n">EVT_HTML_LINK_CLICKED</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnLinkClicked</span> <span class="p">)</span>
+        
+        <span class="c">#open the help frame a the current page</span>
+        <span class="k">if</span>  <span class="n">pageToOpen</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">LoadPage</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">pageToOpen</span><span class="p">))</span>
+            
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+        <span class="n">vboxl</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">lhelp</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rpanel</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lpanel</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vboxl</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lpanel</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        
+        <span class="n">vbox1</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>
+        <span class="n">vbox1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">splitter</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+        <span class="n">splitter</span><span class="o">.</span><span class="n">AppendWindow</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">lpanel</span><span class="p">,</span> <span class="mi">200</span><span class="p">)</span>
+        <span class="n">splitter</span><span class="o">.</span><span class="n">AppendWindow</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">rpanel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox1</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">splitter</span> <span class="o">=</span> <span class="n">splitter</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        <span class="bp">self</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_SIZE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_Size</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="HelpWindow.OnButtonClicked"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.help_panel.HelpWindow.OnButtonClicked">[docs]</a>    <span class="k">def</span> <span class="nf">OnButtonClicked</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Function to diplay Model html page related to the hyperlinktext selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">LoadPage</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="HelpWindow.OnLinkClicked"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.help_panel.HelpWindow.OnLinkClicked">[docs]</a>    <span class="k">def</span> <span class="nf">OnLinkClicked</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Function to diplay html page related to the hyperlinktext selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">link</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetLinkInfo</span><span class="p">()</span><span class="o">.</span><span class="n">GetHref</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">LoadPage</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">link</span><span class="p">))</span>
+        </div>
+<div class="viewcode-block" id="HelpWindow.on_Size"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.help_panel.HelpWindow.on_Size">[docs]</a>    <span class="k">def</span> <span class="nf">on_Size</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Recover the scroll position On Size</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">GetScrollPos</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetClientSize</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">splitter</span><span class="o">.</span><span class="n">SetSize</span><span class="p">(</span><span class="n">size</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">ScrollLines</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span></div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/hint_fitpage.html
===================================================================
--- _modules/sas/perspectives/fitting/hint_fitpage.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/hint_fitpage.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,150 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.hint_fitpage &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.hint_fitpage</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    This class provide general structure of  fitpanel page</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span>
+
+<div class="viewcode-block" id="HintFitPage"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.hint_fitpage.HintFitPage">[docs]</a><span class="k">class</span> <span class="nc">HintFitPage</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">ScrolledWindow</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        This class provide general structure of  fitpanel page</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal name for the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;Hint Page&quot;</span>
+    <span class="c">## Title to appear on top of the window</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;Hint page &quot;</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">ScrolledWindow</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</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">FULL_REPAINT_ON_RESIZE</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">)</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;right click on the data when it is highlighted &quot;</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;the select option to fit for futher options&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">do_layout</span><span class="p">()</span>
+        
+<div class="viewcode-block" id="HintFitPage.do_layout"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.hint_fitpage.HintFitPage.do_layout">[docs]</a>    <span class="k">def</span> <span class="nf">do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Draw the page</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;Hint&quot;</span>
+        <span class="n">box_description</span><span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+        <span class="n">boxsizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">box_description</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;    How to link data to the control panel: </span><span class="se">\n</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;    First load data file from &#39;File&#39; menu. </span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;    Then Highlight and right click on the data plot. </span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;    Finally, select &#39;Select data for fitting&#39; in the pop-up menu. </span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">msg</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">ALIGN_LEFT</span><span class="p">)</span>
+        <span class="n">boxsizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">hint_txt</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Fit</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetScrollbars</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">65</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="HintFitPage.createMemento"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.hint_fitpage.HintFitPage.createMemento">[docs]</a>    <span class="k">def</span> <span class="nf">createMemento</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span>
+        
+        </div></div>
+<div class="viewcode-block" id="HelpWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.hint_fitpage.HelpWindow">[docs]</a><span class="k">class</span> <span class="nc">HelpWindow</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="p">):</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">570</span><span class="p">,</span> <span class="mi">400</span><span class="p">))</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">page</span> <span class="o">=</span> <span class="n">HintFitPage</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/model_thread.html
===================================================================
--- _modules/sas/perspectives/fitting/model_thread.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/model_thread.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,333 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.model_thread &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.model_thread</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Calculation thread for modeling</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">import</span> <span class="nn">numpy</span>
+<span class="kn">import</span> <span class="nn">math</span>
+<span class="kn">from</span> <span class="nn">sas.data_util.calcthread</span> <span class="kn">import</span> <span class="n">CalcThread</span>
+
+<div class="viewcode-block" id="Calc2D"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.model_thread.Calc2D">[docs]</a><span class="k">class</span> <span class="nc">Calc2D</span><span class="p">(</span><span class="n">CalcThread</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Compute 2D model</span>
+<span class="sd">    This calculation assumes a 2-fold symmetry of the model</span>
+<span class="sd">    where points are computed for one half of the detector</span>
+<span class="sd">    and I(qx, qy) = I(-qx, -qy) is assumed.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">model</span><span class="p">,</span> <span class="n">smearer</span><span class="p">,</span> <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="p">,</span> <span class="n">page_id</span><span class="p">,</span>
+                 <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">weight</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">toggle_mode_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+                 <span class="n">completefn</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">updatefn</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+                 <span class="n">source</span><span class="o">=</span><span class="s">&#39;model&#39;</span><span class="p">,</span>
+                 <span class="n">yieldtime</span><span class="o">=</span><span class="mf">0.04</span><span class="p">,</span>
+                 <span class="n">worktime</span><span class="o">=</span><span class="mf">0.04</span>
+                 <span class="p">):</span>
+        <span class="n">CalcThread</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">completefn</span><span class="p">,</span> <span class="n">updatefn</span><span class="p">,</span> <span class="n">yieldtime</span><span class="p">,</span> <span class="n">worktime</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="n">qmin</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weight</span> <span class="o">=</span> <span class="n">weight</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fid</span> <span class="o">=</span> <span class="n">fid</span>
+        <span class="c">#self.qstep = qstep</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">toggle_mode_on</span> <span class="o">=</span> <span class="n">toggle_mode_on</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_id</span> <span class="o">=</span> <span class="n">page_id</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># the model on to calculate</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer</span> <span class="o">=</span> <span class="n">smearer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">update_chisqr</span> <span class="o">=</span> <span class="n">update_chisqr</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">source</span>
+        
+<div class="viewcode-block" id="Calc2D.compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.model_thread.Calc2D.compute">[docs]</a>    <span class="k">def</span> <span class="nf">compute</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Compute the data given a model function</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="c"># Determine appropriate q range</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">newx</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">pow</span><span class="p">(</span><span class="nb">max</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xmax</span><span class="p">),</span>
+                                   <span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">xmin</span><span class="p">)),</span> <span class="mi">2</span><span class="p">)</span>
+                <span class="n">newy</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">pow</span><span class="p">(</span><span class="nb">max</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">ymax</span><span class="p">),</span>
+                                   <span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">ymin</span><span class="p">)),</span> <span class="mi">2</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">newx</span> <span class="o">+</span> <span class="n">newy</span><span class="p">)</span>
+        
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Compute Calc2D receive data = </span><span class="si">%s</span><span class="s">.</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">msg</span>
+            
+        <span class="c"># Define matrix where data will be plotted</span>
+        <span class="n">radius</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">sqrt</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span><span class="p">)</span> <span class="o">+</span> \
+                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qy_data</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qy_data</span><span class="p">))</span>
+
+        <span class="c"># For theory, qmax is based on 1d qmax </span>
+        <span class="c"># so that must be mulitified by sqrt(2) to get actual max for 2d</span>
+        <span class="n">index_model</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">&lt;=</span> <span class="n">radius</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">radius</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+        <span class="n">index_model</span> <span class="o">=</span> <span class="n">index_model</span> <span class="o">&amp;</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">mask</span>
+        <span class="n">index_model</span> <span class="o">=</span> <span class="n">index_model</span> <span class="o">&amp;</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+      
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">smearer</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c"># Set smearer w/ data, model and index.</span>
+            <span class="n">fn</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">smearer</span>
+            <span class="n">fn</span><span class="o">.</span><span class="n">set_model</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+            <span class="n">fn</span><span class="o">.</span><span class="n">set_index</span><span class="p">(</span><span class="n">index_model</span><span class="p">)</span>
+            <span class="c"># Get necessary data from self.data and set the data for smearing</span>
+            <span class="n">fn</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+            <span class="c"># Calculate smeared Intensity</span>
+            <span class="c">#(by Gaussian averaging): DataLoader/smearing2d/Smearer2D()</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="n">fn</span><span class="o">.</span><span class="n">get_value</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># calculation w/o smearing</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">evalDistribution</span><span class="p">(</span>\
+                <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span><span class="p">[</span><span class="n">index_model</span><span class="p">],</span>
+                 <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qy_data</span><span class="p">[</span><span class="n">index_model</span><span class="p">]])</span>
+        <span class="n">output</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">qx_data</span><span class="p">))</span>
+        <span class="c"># output default is None</span>
+        <span class="c"># This method is to distinguish between masked</span>
+        <span class="c">#point(nan) and data point = 0.</span>
+        <span class="n">output</span> <span class="o">=</span> <span class="n">output</span> <span class="o">/</span> <span class="n">output</span>
+        <span class="c"># set value for self.mask==True, else still None to Plottools</span>
+        <span class="n">output</span><span class="p">[</span><span class="n">index_model</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
+        <span class="n">elapsed</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">(</span><span class="n">image</span><span class="o">=</span><span class="n">output</span><span class="p">,</span>
+                       <span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span>
+                       <span class="n">page_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">page_id</span><span class="p">,</span>
+                       <span class="n">model</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">,</span>
+                       <span class="n">state</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="p">,</span>
+                       <span class="n">toggle_mode_on</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">toggle_mode_on</span><span class="p">,</span>
+                       <span class="n">elapsed</span><span class="o">=</span><span class="n">elapsed</span><span class="p">,</span>
+                       <span class="n">index</span><span class="o">=</span><span class="n">index_model</span><span class="p">,</span>
+                       <span class="n">fid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fid</span><span class="p">,</span>
+                       <span class="n">qmin</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span>
+                       <span class="n">qmax</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">,</span>
+                       <span class="n">weight</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">weight</span><span class="p">,</span>
+                       <span class="c">#qstep=self.qstep,</span>
+                       <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">update_chisqr</span><span class="p">,</span>
+                       <span class="n">source</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        
+</div></div>
+<div class="viewcode-block" id="Calc1D"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.model_thread.Calc1D">[docs]</a><span class="k">class</span> <span class="nc">Calc1D</span><span class="p">(</span><span class="n">CalcThread</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Compute 1D data</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">,</span>
+                 <span class="n">page_id</span><span class="p">,</span>
+                 <span class="n">data</span><span class="p">,</span>
+                 <span class="n">fid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">qmin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">qmax</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">weight</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">smearer</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">toggle_mode_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+                 <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">completefn</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+                 <span class="n">source</span><span class="o">=</span><span class="s">&#39;model&#39;</span><span class="p">,</span>
+                 <span class="n">updatefn</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">yieldtime</span><span class="o">=</span><span class="mf">0.01</span><span class="p">,</span>
+                 <span class="n">worktime</span><span class="o">=</span><span class="mf">0.01</span>
+                 <span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">CalcThread</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">completefn</span><span class="p">,</span>
+                 <span class="n">updatefn</span><span class="p">,</span>
+                 <span class="n">yieldtime</span><span class="p">,</span>
+                 <span class="n">worktime</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fid</span> <span class="o">=</span> <span class="n">fid</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="n">qmin</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="n">qmax</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weight</span> <span class="o">=</span> <span class="n">weight</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">toggle_mode_on</span> <span class="o">=</span> <span class="n">toggle_mode_on</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="n">state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_id</span> <span class="o">=</span> <span class="n">page_id</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer</span> <span class="o">=</span> <span class="n">smearer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">update_chisqr</span> <span class="o">=</span> <span class="n">update_chisqr</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">source</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">out</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">index</span> <span class="o">=</span> <span class="bp">None</span>
+        
+<div class="viewcode-block" id="Calc1D.compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.model_thread.Calc1D.compute">[docs]</a>    <span class="k">def</span> <span class="nf">compute</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Compute model 1d value given qmin , qmax , x value</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="n">output</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)))</span>
+        <span class="n">index</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span> <span class="o">&lt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+     
+        <span class="c">##smearer the ouput of the plot</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">smearer</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">first_bin</span><span class="p">,</span> <span class="n">last_bin</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">smearer</span><span class="o">.</span><span class="n">get_bin_range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">,</span>
+                                                             <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+            <span class="n">mask</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">[</span><span class="n">first_bin</span><span class="p">:</span><span class="n">last_bin</span><span class="p">]</span>
+            <span class="n">output</span><span class="p">[</span><span class="n">first_bin</span><span class="p">:</span><span class="n">last_bin</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">evalDistribution</span><span class="p">(</span><span class="n">mask</span><span class="p">)</span>
+            <span class="n">output</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">smearer</span><span class="p">(</span><span class="n">output</span><span class="p">,</span> <span class="n">first_bin</span><span class="p">,</span> <span class="n">last_bin</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">output</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">evalDistribution</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">[</span><span class="n">index</span><span class="p">])</span>
+         
+        <span class="n">elapsed</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">[</span><span class="n">index</span><span class="p">],</span> <span class="n">y</span><span class="o">=</span><span class="n">output</span><span class="p">[</span><span class="n">index</span><span class="p">],</span>
+                      <span class="n">page_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">page_id</span><span class="p">,</span>
+                      <span class="n">state</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="p">,</span>
+                      <span class="n">weight</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">weight</span><span class="p">,</span>
+                      <span class="n">fid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fid</span><span class="p">,</span>
+                      <span class="n">toggle_mode_on</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">toggle_mode_on</span><span class="p">,</span>
+                      <span class="n">elapsed</span><span class="o">=</span><span class="n">elapsed</span><span class="p">,</span> <span class="n">index</span><span class="o">=</span><span class="n">index</span><span class="p">,</span> <span class="n">model</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">,</span>
+                      <span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span>
+                      <span class="n">update_chisqr</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">update_chisqr</span><span class="p">,</span>
+                      <span class="n">source</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Calc1D.results"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.model_thread.Calc1D.results">[docs]</a>    <span class="k">def</span> <span class="nf">results</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Send resuts of the computation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">out</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">index</span><span class="p">]</span>
+</div></div>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Example: ::</span>
+<span class="sd">                     </span>
+<span class="sd">    class CalcCommandline:</span>
+<span class="sd">        def __init__(self, n=20000):</span>
+<span class="sd">            #print thread.get_ident()</span>
+<span class="sd">            from sas.models.CylinderModel import CylinderModel</span>
+<span class="sd">            </span>
+<span class="sd">            model = CylinderModel()</span>
+<span class="sd">            </span>
+<span class="sd">             </span>
+<span class="sd">            print model.runXY([0.01, 0.02])</span>
+<span class="sd">            </span>
+<span class="sd">            qmax = 0.01</span>
+<span class="sd">            qstep = 0.0001</span>
+<span class="sd">            self.done = False</span>
+<span class="sd">            </span>
+<span class="sd">            x = numpy.arange(-qmax, qmax+qstep*0.01, qstep)</span>
+<span class="sd">            y = numpy.arange(-qmax, qmax+qstep*0.01, qstep)</span>
+<span class="sd">        </span>
+<span class="sd">        </span>
+<span class="sd">            calc_thread_2D = Calc2D(x, y, None, model.clone(),None,</span>
+<span class="sd">                                    -qmax, qmax,qstep,</span>
+<span class="sd">                                            completefn=self.complete,</span>
+<span class="sd">                                            updatefn=self.update ,</span>
+<span class="sd">                                            yieldtime=0.0)</span>
+<span class="sd">         </span>
+<span class="sd">            calc_thread_2D.queue()</span>
+<span class="sd">            calc_thread_2D.ready(2.5)</span>
+<span class="sd">            </span>
+<span class="sd">            while not self.done:</span>
+<span class="sd">                time.sleep(1)</span>
+<span class="sd">    </span>
+<span class="sd">        def update(self,output):</span>
+<span class="sd">            print &quot;update&quot;</span>
+<span class="sd">    </span>
+<span class="sd">        def complete(self, image, data, model, elapsed, qmin, qmax,index, qstep ):</span>
+<span class="sd">            print &quot;complete&quot;</span>
+<span class="sd">            self.done = True</span>
+<span class="sd">    </span>
+<span class="sd">    if __name__ == &quot;__main__&quot;:</span>
+<span class="sd">        CalcCommandline()</span>
+<span class="sd">&quot;&quot;&quot;</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/models.html
===================================================================
--- _modules/sas/perspectives/fitting/models.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/models.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,1143 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.models &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.models</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Utilities to manage models</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">imp</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">math</span>
+<span class="kn">import</span> <span class="nn">os.path</span>
+<span class="c"># Time is needed by the log method</span>
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">import</span> <span class="nn">logging</span>
+<span class="kn">import</span> <span class="nn">py_compile</span>
+<span class="kn">import</span> <span class="nn">shutil</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>
+<span class="c"># Explicitly import from the pluginmodel module so that py2exe</span>
+<span class="c"># places it in the distribution. The Model1DPlugin class is used</span>
+<span class="c"># as the base class of plug-in models.</span>
+<span class="kn">from</span> <span class="nn">sas.models.pluginmodel</span> <span class="kn">import</span> <span class="n">Model1DPlugin</span>
+<span class="kn">from</span> <span class="nn">sas.models.BaseComponent</span> <span class="kn">import</span> <span class="n">BaseComponent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.CategoryInstaller</span> <span class="kn">import</span> <span class="n">CategoryInstaller</span>
+   
+<span class="n">PLUGIN_DIR</span> <span class="o">=</span> <span class="s">&#39;plugin_models&#39;</span>
+
+<div class="viewcode-block" id="get_model_python_path"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.get_model_python_path">[docs]</a><span class="k">def</span> <span class="nf">get_model_python_path</span><span class="p">():</span>
+    <span class="k">return</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">)</span>
+
+</div>
+<div class="viewcode-block" id="log"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.log">[docs]</a><span class="k">def</span> <span class="nf">log</span><span class="p">(</span><span class="n">message</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Log a message in a file located in the user&#39;s home directory</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="nb">dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">expanduser</span><span class="p">(</span><span class="s">&quot;~&quot;</span><span class="p">),</span> <span class="s">&#39;.sasview&#39;</span><span class="p">,</span> <span class="n">PLUGIN_DIR</span><span class="p">)</span>
+    <span class="n">out</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">dir</span><span class="p">,</span> <span class="s">&quot;plugins.log&quot;</span><span class="p">),</span> <span class="s">&#39;a&#39;</span><span class="p">)</span>
+    <span class="n">out</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%10g</span><span class="s">:  </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">clock</span><span class="p">(),</span> <span class="n">message</span><span class="p">))</span>
+    <span class="n">out</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+
+</div>
+<span class="k">def</span> <span class="nf">_check_plugin</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Do some checking before model adding plugins in the list</span>
+<span class="sd">    </span>
+<span class="sd">    :param model: class model to add into the plugin list</span>
+<span class="sd">    :param name:name of the module plugin</span>
+<span class="sd">    </span>
+<span class="sd">    :return model: model if valid model or None if not valid</span>
+<span class="sd">    </span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">#Check if the plugin is of type Model1DPlugin</span>
+    <span class="k">if</span> <span class="ow">not</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">Model1DPlugin</span><span class="p">):</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Plugin </span><span class="si">%s</span><span class="s"> must be of type Model1DPlugin </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="n">log</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">None</span>
+    <span class="k">if</span> <span class="n">model</span><span class="o">.</span><span class="n">__name__</span> <span class="o">!=</span> <span class="s">&quot;Model&quot;</span><span class="p">:</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Plugin </span><span class="si">%s</span><span class="s"> class name must be Model </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="n">log</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">None</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="n">new_instance</span> <span class="o">=</span> <span class="n">model</span><span class="p">()</span>
+    <span class="k">except</span><span class="p">:</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Plugin </span><span class="si">%s</span><span class="s"> error in __init__ </span><span class="se">\n\t</span><span class="s">: </span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">),</span>
+                                    <span class="nb">str</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_type</span><span class="p">),</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+        <span class="n">log</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">None</span>
+   
+    <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">new_instance</span><span class="p">,</span> <span class="s">&quot;function&quot;</span><span class="p">):</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="n">new_instance</span><span class="o">.</span><span class="n">function</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Plugin </span><span class="si">%s</span><span class="s">: error writing function </span><span class="se">\n\t</span><span class="s"> :</span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="se">\n</span><span class="s"> &quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">),</span>
+                                    <span class="nb">str</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_type</span><span class="p">),</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+            <span class="n">log</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+            <span class="k">return</span> <span class="bp">None</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Plugin  </span><span class="si">%s</span><span class="s"> needs a method called function </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="n">log</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">None</span>
+    <span class="k">return</span> <span class="n">model</span>
+  
+  
+<div class="viewcode-block" id="find_plugins_dir"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.find_plugins_dir">[docs]</a><span class="k">def</span> <span class="nf">find_plugins_dir</span><span class="p">():</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Find path of the plugins directory.</span>
+<span class="sd">        The plugin directory is located in the user&#39;s home directory.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="nb">dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">expanduser</span><span class="p">(</span><span class="s">&quot;~&quot;</span><span class="p">),</span> <span class="s">&#39;.sasview&#39;</span><span class="p">,</span> <span class="n">PLUGIN_DIR</span><span class="p">)</span>
+    
+    <span class="c"># If the plugin directory doesn&#39;t exist, create it</span>
+    <span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="nb">dir</span><span class="p">):</span>
+        <span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="nb">dir</span><span class="p">)</span>
+        
+    <span class="c"># Find paths needed</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="c"># For source</span>
+        <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">)):</span>
+            <span class="n">p_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">),</span> <span class="n">PLUGIN_DIR</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">raise</span>
+    <span class="k">except</span><span class="p">:</span>
+        <span class="c"># Check for data path next to exe/zip file.</span>
+        <span class="c">#Look for maximum n_dir up of the current dir to find plugins dir</span>
+        <span class="n">n_dir</span> <span class="o">=</span> <span class="mi">12</span>
+        <span class="n">p_dir</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">f_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">))</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">n_dir</span><span class="p">):</span>
+            <span class="k">if</span> <span class="n">i</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="n">f_dir</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">f_dir</span><span class="p">)</span>
+            <span class="n">plugin_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">f_dir</span><span class="p">,</span> <span class="n">PLUGIN_DIR</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">plugin_path</span><span class="p">):</span>
+                <span class="n">p_dir</span> <span class="o">=</span> <span class="n">plugin_path</span>
+                <span class="k">break</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">p_dir</span><span class="p">:</span>
+            <span class="k">raise</span>
+    <span class="c"># Place example user models as needed</span>
+    <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">p_dir</span><span class="p">):</span>
+        <span class="k">for</span> <span class="nb">file</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="n">p_dir</span><span class="p">):</span>
+            <span class="n">file_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">p_dir</span><span class="p">,</span> <span class="nb">file</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">file_path</span><span class="p">):</span>
+                <span class="k">if</span> <span class="nb">file</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;.&quot;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;py&#39;</span> <span class="ow">and</span>\
+                    <span class="nb">file</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;.&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&#39;__init__&#39;</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">dir</span><span class="p">,</span> <span class="nb">file</span><span class="p">)):</span>
+                        <span class="n">shutil</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">file_path</span><span class="p">,</span> <span class="nb">dir</span><span class="p">)</span>
+
+    <span class="k">return</span> <span class="nb">dir</span>
+
+</div>
+<div class="viewcode-block" id="ReportProblem"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ReportProblem">[docs]</a><span class="k">class</span> <span class="nc">ReportProblem</span><span class="p">:</span>
+    <span class="k">def</span> <span class="nf">__nonzero__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="nb">type</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">traceback</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_info</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">type</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">issubclass</span><span class="p">(</span><span class="nb">type</span><span class="p">,</span> <span class="n">py_compile</span><span class="o">.</span><span class="n">PyCompileError</span><span class="p">):</span>
+            <span class="k">print</span> <span class="s">&quot;Problem with&quot;</span><span class="p">,</span> <span class="nb">repr</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+            <span class="k">raise</span> <span class="nb">type</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">traceback</span>
+        <span class="k">return</span> <span class="mi">1</span>
+    </div>
+<span class="n">report_problem</span> <span class="o">=</span> <span class="n">ReportProblem</span><span class="p">()</span>
+
+
+<div class="viewcode-block" id="compile_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.compile_file">[docs]</a><span class="k">def</span> <span class="nf">compile_file</span><span class="p">(</span><span class="nb">dir</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Compile a py file</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="kn">import</span> <span class="nn">compileall</span>
+        <span class="n">compileall</span><span class="o">.</span><span class="n">compile_dir</span><span class="p">(</span><span class="nb">dir</span><span class="o">=</span><span class="nb">dir</span><span class="p">,</span> <span class="n">ddir</span><span class="o">=</span><span class="nb">dir</span><span class="p">,</span> <span class="n">force</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
+                               <span class="n">quiet</span><span class="o">=</span><span class="n">report_problem</span><span class="p">)</span>
+    <span class="k">except</span><span class="p">:</span>
+        <span class="nb">type</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">traceback</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_info</span><span class="p">()</span>
+        <span class="k">return</span> <span class="n">value</span>
+    <span class="k">return</span> <span class="bp">None</span>
+
+</div>
+<span class="k">def</span> <span class="nf">_findModels</span><span class="p">(</span><span class="nb">dir</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c"># List of plugin objects</span>
+    <span class="n">plugins</span> <span class="o">=</span> <span class="p">{}</span>
+    <span class="c"># Go through files in plug-in directory</span>
+    <span class="c">#always recompile the folder plugin</span>
+    <span class="nb">dir</span> <span class="o">=</span> <span class="n">find_plugins_dir</span><span class="p">()</span>
+    <span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="nb">dir</span><span class="p">):</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;SasView couldn&#39;t locate Model plugin folder.&quot;</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;&quot;&quot; &quot;</span><span class="si">%s</span><span class="s">&quot; does not exist&quot;&quot;&quot;</span> <span class="o">%</span> <span class="nb">dir</span>
+        <span class="n">logging</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">plugins</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="n">log</span><span class="p">(</span><span class="s">&quot;looking for models in: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="nb">dir</span><span class="p">))</span>
+        <span class="n">compile_file</span><span class="p">(</span><span class="nb">dir</span><span class="p">)</span>
+        <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;pluging model dir: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="nb">dir</span><span class="p">))</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="nb">list</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="nb">dir</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">:</span>
+            <span class="n">toks</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">item</span><span class="p">))</span>
+            <span class="k">if</span> <span class="n">toks</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;.py&#39;</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;__init__&#39;</span><span class="p">:</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            
+                <span class="n">path</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="nb">dir</span><span class="p">)]</span>
+                <span class="nb">file</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="p">(</span><span class="nb">file</span><span class="p">,</span> <span class="n">path</span><span class="p">,</span> <span class="n">info</span><span class="p">)</span> <span class="o">=</span> <span class="n">imp</span><span class="o">.</span><span class="n">find_module</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">path</span><span class="p">)</span>
+                    <span class="n">module</span> <span class="o">=</span> <span class="n">imp</span><span class="o">.</span><span class="n">load_module</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="nb">file</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">info</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">module</span><span class="p">,</span> <span class="s">&quot;Model&quot;</span><span class="p">):</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="k">if</span> <span class="n">_check_plugin</span><span class="p">(</span><span class="n">module</span><span class="o">.</span><span class="n">Model</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                                <span class="n">plugins</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">module</span><span class="o">.</span><span class="n">Model</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error accessing Model&quot;</span>
+                            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;in </span><span class="si">%s</span><span class="se">\n</span><span class="s">  </span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span>
+                                    <span class="nb">str</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_type</span><span class="p">),</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+                            <span class="n">log</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error accessing Model&quot;</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; in </span><span class="si">%s</span><span class="se">\n</span><span class="s">  </span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span>
+                                    <span class="nb">str</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_type</span><span class="p">),</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+                    <span class="n">log</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+                <span class="k">finally</span><span class="p">:</span>
+              
+                    <span class="k">if</span> <span class="ow">not</span> <span class="nb">file</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="nb">file</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+    <span class="k">except</span><span class="p">:</span>
+        <span class="c"># Don&#39;t deal with bad plug-in imports. Just skip.</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Could not import model plugin: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+        <span class="n">log</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+        <span class="k">pass</span>
+    <span class="k">return</span> <span class="n">plugins</span>
+
+
+<div class="viewcode-block" id="ModelList"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelList">[docs]</a><span class="k">class</span> <span class="nc">ModelList</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Contains dictionary of model and their type</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mydict</span> <span class="o">=</span> <span class="p">{}</span>
+        
+<div class="viewcode-block" id="ModelList.set_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelList.set_list">[docs]</a>    <span class="k">def</span> <span class="nf">set_list</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">mylist</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :param name: the type of the list</span>
+<span class="sd">        :param mylist: the list to add</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">mydict</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">reset_list</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">mylist</span><span class="p">)</span>
+            </div>
+<div class="viewcode-block" id="ModelList.reset_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelList.reset_list">[docs]</a>    <span class="k">def</span> <span class="nf">reset_list</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">mylist</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :param name: the type of the list</span>
+<span class="sd">        :param mylist: the list to add</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">mydict</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">mylist</span>
+            </div>
+<div class="viewcode-block" id="ModelList.get_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelList.get_list">[docs]</a>    <span class="k">def</span> <span class="nf">get_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return all the list stored in a dictionary object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">mydict</span>
+        
+        </div></div>
+<div class="viewcode-block" id="ModelManagerBase"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManagerBase">[docs]</a><span class="k">class</span> <span class="nc">ModelManagerBase</span><span class="p">:</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Base class for the model manager</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## external dict for models</span>
+    <span class="n">model_combobox</span> <span class="o">=</span> <span class="n">ModelList</span><span class="p">()</span>
+    <span class="c">## Dictionary of form factor models</span>
+    <span class="n">form_factor_dict</span> <span class="o">=</span> <span class="p">{}</span>
+    <span class="c">## dictionary of structure factor models</span>
+    <span class="n">struct_factor_dict</span> <span class="o">=</span> <span class="p">{}</span>
+    <span class="c">##list of shape models -- this is superseded by categories </span>
+<span class="c">#    shape_list = []</span>
+    <span class="c">## shape independent model list-- this is superseded by categories</span>
+<span class="c">#    shape_indep_list = []</span>
+    <span class="c">##list of structure factors</span>
+    <span class="n">struct_list</span> <span class="o">=</span> <span class="p">[]</span>
+    <span class="c">##list of model allowing multiplication by a structure factor</span>
+    <span class="n">multiplication_factor</span> <span class="o">=</span> <span class="p">[]</span>
+    <span class="c">##list of multifunctional shapes (i.e. that have user defined number of levels</span>
+    <span class="n">multi_func_list</span> <span class="o">=</span> <span class="p">[]</span>
+    <span class="c">## list of added models -- currently python models found in the plugin dir.</span>
+    <span class="n">plugins</span> <span class="o">=</span> <span class="p">[]</span>
+    <span class="c">## Event owner (guiframe)</span>
+    <span class="n">event_owner</span> <span class="o">=</span> <span class="bp">None</span>
+    <span class="n">last_time_dir_modified</span> <span class="o">=</span> <span class="mi">0</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">stored_plugins</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_getModelList</span><span class="p">()</span>
+        
+<div class="viewcode-block" id="ModelManagerBase.findModels"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManagerBase.findModels">[docs]</a>    <span class="k">def</span> <span class="nf">findModels</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        find  plugin model in directory of plugin .recompile all file</span>
+<span class="sd">        in the directory if file were modified</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">temp</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_changed</span><span class="p">():</span>
+            <span class="k">return</span>  <span class="n">_findModels</span><span class="p">(</span><span class="nb">dir</span><span class="p">)</span>
+        <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;pluging model : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">temp</span><span class="p">))</span>
+        <span class="k">return</span> <span class="n">temp</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_getModelList</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        List of models we want to make available by default</span>
+<span class="sd">        for this application</span>
+<span class="sd">    </span>
+<span class="sd">        :return: the next free event ID following the new menu events</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+
+        <span class="c">## NOTE: as of April 26, 2014, as part of first pass on fixing categories,</span>
+        <span class="c">## all the appends to shape_list or shape_independent_list are </span>
+        <span class="c">## commented out.  They should be possible to remove.  They are in </span>
+        <span class="c">## fact a &quot;category&quot; of model whereas the other list are actually </span>
+        <span class="c">## &quot;attributes&quot; of a model.  In other words is it a structure factor</span>
+        <span class="c">## that can be used against a form factor, is it a form factor that is</span>
+        <span class="c">## knows how to be multiplied by a structure factor, does it have user</span>
+        <span class="c">## defined number of parameters, etc.</span>
+        <span class="c">##</span>
+        <span class="c">## We hope this whole list will be superseded by the new C models</span>
+        <span class="c">## structure where each model will provide a method to interrogate it</span>
+        <span class="c">## about its &quot;attributes&quot; -- then this long list becomes a loop reading</span>
+        <span class="c">## each model in the category list to populate the &quot;attribute&quot;lists.  </span>
+        <span class="c">## We should also refactor the whole category vs attribute list </span>
+        <span class="c">## structure when doing this as now the attribute lists think they are</span>
+        <span class="c">## also category lists.</span>
+        <span class="c">##</span>
+        <span class="c">##   -PDB  April 26, 2014</span>
+
+        <span class="c"># regular model names only</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="kn">from</span> <span class="nn">sas.models.SphereModel</span> <span class="kn">import</span> <span class="n">SphereModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">SphereModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">SphereModel</span>
+<span class="c">#        self.shape_list.append(SphereModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">SphereModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">SphereModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.BinaryHSModel</span> <span class="kn">import</span> <span class="n">BinaryHSModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">BinaryHSModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">BinaryHSModel</span>
+<span class="c">#        self.shape_list.append(BinaryHSModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">BinaryHSModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+                        
+        <span class="kn">from</span> <span class="nn">sas.models.FuzzySphereModel</span> <span class="kn">import</span> <span class="n">FuzzySphereModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">FuzzySphereModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySphereModel</span>
+<span class="c">#        self.shape_list.append(FuzzySphereModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">FuzzySphereModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">FuzzySphereModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+                        
+        <span class="kn">from</span> <span class="nn">sas.models.RaspBerryModel</span> <span class="kn">import</span> <span class="n">RaspBerryModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">RaspBerryModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">RaspBerryModel</span>
+<span class="c">#        self.shape_list.append(RaspBerryModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">RaspBerryModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+                
+        <span class="kn">from</span> <span class="nn">sas.models.CoreShellModel</span> <span class="kn">import</span> <span class="n">CoreShellModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">CoreShellModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">CoreShellModel</span>
+<span class="c">#        self.shape_list.append(CoreShellModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreShellModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreShellModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.Core2ndMomentModel</span> <span class="kn">import</span> <span class="n">Core2ndMomentModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">Core2ndMomentModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">Core2ndMomentModel</span>
+<span class="c">#        self.shape_list.append(Core2ndMomentModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Core2ndMomentModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.CoreMultiShellModel</span> <span class="kn">import</span> <span class="n">CoreMultiShellModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">CoreMultiShellModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">CoreMultiShellModel</span>
+<span class="c">#        self.shape_list.append(CoreMultiShellModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreMultiShellModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multi_func_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreMultiShellModel</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.VesicleModel</span> <span class="kn">import</span> <span class="n">VesicleModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">VesicleModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">VesicleModel</span>
+<span class="c">#        self.shape_list.append(VesicleModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">VesicleModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">VesicleModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.MultiShellModel</span> <span class="kn">import</span> <span class="n">MultiShellModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">MultiShellModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">MultiShellModel</span>
+<span class="c">#        self.shape_list.append(MultiShellModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">MultiShellModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">MultiShellModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.OnionExpShellModel</span> <span class="kn">import</span> <span class="n">OnionExpShellModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">OnionExpShellModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">OnionExpShellModel</span>
+<span class="c">#        self.shape_list.append(OnionExpShellModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">OnionExpShellModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multi_func_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">OnionExpShellModel</span><span class="p">)</span>
+                         
+        <span class="kn">from</span> <span class="nn">sas.models.SphericalSLDModel</span> <span class="kn">import</span> <span class="n">SphericalSLDModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">SphericalSLDModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">SphericalSLDModel</span>
+<span class="c">#        self.shape_list.append(SphericalSLDModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">SphericalSLDModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multi_func_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">SphericalSLDModel</span><span class="p">)</span>
+
+        
+        <span class="kn">from</span> <span class="nn">sas.models.LinearPearlsModel</span> <span class="kn">import</span> <span class="n">LinearPearlsModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">LinearPearlsModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">LinearPearlsModel</span>
+<span class="c">#        self.shape_list.append(LinearPearlsModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">LinearPearlsModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+          
+        <span class="kn">from</span> <span class="nn">sas.models.PearlNecklaceModel</span> <span class="kn">import</span> <span class="n">PearlNecklaceModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">PearlNecklaceModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">PearlNecklaceModel</span>
+<span class="c">#        self.shape_list.append(PearlNecklaceModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">PearlNecklaceModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        <span class="c">#self.multiplication_factor.append(PearlNecklaceModel)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.CylinderModel</span> <span class="kn">import</span> <span class="n">CylinderModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">CylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">CylinderModel</span>
+<span class="c">#        self.shape_list.append(CylinderModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CylinderModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.CoreShellCylinderModel</span> <span class="kn">import</span> <span class="n">CoreShellCylinderModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">CoreShellCylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">CoreShellCylinderModel</span>
+<span class="c">#        self.shape_list.append(CoreShellCylinderModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreShellCylinderModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreShellCylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.CoreShellBicelleModel</span> <span class="kn">import</span> <span class="n">CoreShellBicelleModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">CoreShellBicelleModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">CoreShellBicelleModel</span>
+<span class="c">#        self.shape_list.append(CoreShellBicelleModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreShellBicelleModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreShellBicelleModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+                
+        <span class="kn">from</span> <span class="nn">sas.models.HollowCylinderModel</span> <span class="kn">import</span> <span class="n">HollowCylinderModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">HollowCylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">HollowCylinderModel</span>
+<span class="c">#        self.shape_list.append(HollowCylinderModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">HollowCylinderModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">HollowCylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+              
+        <span class="kn">from</span> <span class="nn">sas.models.FlexibleCylinderModel</span> <span class="kn">import</span> <span class="n">FlexibleCylinderModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">FlexibleCylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">FlexibleCylinderModel</span>
+<span class="c">#        self.shape_list.append(FlexibleCylinderModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">FlexibleCylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.FlexCylEllipXModel</span> <span class="kn">import</span> <span class="n">FlexCylEllipXModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">FlexCylEllipXModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">FlexCylEllipXModel</span>
+<span class="c">#        self.shape_list.append(FlexCylEllipXModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">FlexCylEllipXModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.StackedDisksModel</span> <span class="kn">import</span> <span class="n">StackedDisksModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">StackedDisksModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">StackedDisksModel</span>
+<span class="c">#        self.shape_list.append(StackedDisksModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">StackedDisksModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">StackedDisksModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.ParallelepipedModel</span> <span class="kn">import</span> <span class="n">ParallelepipedModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">ParallelepipedModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">ParallelepipedModel</span>
+<span class="c">#        self.shape_list.append(ParallelepipedModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ParallelepipedModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ParallelepipedModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.CSParallelepipedModel</span> <span class="kn">import</span> <span class="n">CSParallelepipedModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">CSParallelepipedModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">CSParallelepipedModel</span>
+<span class="c">#        self.shape_list.append(CSParallelepipedModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CSParallelepipedModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CSParallelepipedModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.EllipticalCylinderModel</span> <span class="kn">import</span> <span class="n">EllipticalCylinderModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">EllipticalCylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">EllipticalCylinderModel</span>
+<span class="c">#        self.shape_list.append(EllipticalCylinderModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">EllipticalCylinderModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">EllipticalCylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.BarBellModel</span> <span class="kn">import</span> <span class="n">BarBellModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">BarBellModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">BarBellModel</span>
+<span class="c">#        self.shape_list.append(BarBellModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">BarBellModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        <span class="c"># not implemeted yet!</span>
+        <span class="c">#self.multiplication_factor.append(BarBellModel)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.CappedCylinderModel</span> <span class="kn">import</span> <span class="n">CappedCylinderModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">CappedCylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">CappedCylinderModel</span>
+ <span class="c">#       self.shape_list.append(CappedCylinderModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CappedCylinderModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        <span class="c"># not implemeted yet!</span>
+        <span class="c">#self.multiplication_factor.append(CappedCylinderModel)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.EllipsoidModel</span> <span class="kn">import</span> <span class="n">EllipsoidModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">EllipsoidModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">EllipsoidModel</span>
+<span class="c">#        self.shape_list.append(EllipsoidModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">EllipsoidModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">EllipsoidModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+      
+        <span class="kn">from</span> <span class="nn">sas.models.CoreShellEllipsoidModel</span> <span class="kn">import</span> <span class="n">CoreShellEllipsoidModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">CoreShellEllipsoidModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">CoreShellEllipsoidModel</span>
+<span class="c">#        self.shape_list.append(CoreShellEllipsoidModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreShellEllipsoidModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreShellEllipsoidModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.CoreShellEllipsoidXTModel</span> <span class="kn">import</span> <span class="n">CoreShellEllipsoidXTModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">CoreShellEllipsoidXTModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">CoreShellEllipsoidXTModel</span>
+<span class="c">#        self.shape_list.append(CoreShellEllipsoidXTModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreShellEllipsoidXTModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CoreShellEllipsoidXTModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+         
+        <span class="kn">from</span> <span class="nn">sas.models.TriaxialEllipsoidModel</span> <span class="kn">import</span> <span class="n">TriaxialEllipsoidModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">TriaxialEllipsoidModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">TriaxialEllipsoidModel</span>
+<span class="c">#        self.shape_list.append(TriaxialEllipsoidModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">TriaxialEllipsoidModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">TriaxialEllipsoidModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.LamellarModel</span> <span class="kn">import</span> <span class="n">LamellarModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">LamellarModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">LamellarModel</span>
+<span class="c">#        self.shape_list.append(LamellarModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">LamellarModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.LamellarFFHGModel</span> <span class="kn">import</span> <span class="n">LamellarFFHGModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">LamellarFFHGModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">LamellarFFHGModel</span>
+<span class="c">#        self.shape_list.append(LamellarFFHGModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">LamellarFFHGModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.LamellarPSModel</span> <span class="kn">import</span> <span class="n">LamellarPSModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">LamellarPSModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">LamellarPSModel</span>
+<span class="c">#        self.shape_list.append(LamellarPSModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">LamellarPSModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+     
+        <span class="kn">from</span> <span class="nn">sas.models.LamellarPSHGModel</span> <span class="kn">import</span> <span class="n">LamellarPSHGModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">LamellarPSHGModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">LamellarPSHGModel</span>
+<span class="c">#        self.shape_list.append(LamellarPSHGModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">LamellarPSHGModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.LamellarPCrystalModel</span> <span class="kn">import</span> <span class="n">LamellarPCrystalModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">LamellarPCrystalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">LamellarPCrystalModel</span>
+<span class="c">#        self.shape_list.append(LamellarPCrystalModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">LamellarPCrystalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.SCCrystalModel</span> <span class="kn">import</span> <span class="n">SCCrystalModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">SCCrystalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">SCCrystalModel</span>
+<span class="c">#        self.shape_list.append(SCCrystalModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">SCCrystalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.FCCrystalModel</span> <span class="kn">import</span> <span class="n">FCCrystalModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">FCCrystalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">FCCrystalModel</span>
+<span class="c">#        self.shape_list.append(FCCrystalModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">FCCrystalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.BCCrystalModel</span> <span class="kn">import</span> <span class="n">BCCrystalModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">BCCrystalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">BCCrystalModel</span>
+<span class="c">#        self.shape_list.append(BCCrystalModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">BCCrystalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+      
+        <span class="c">## Structure factor</span>
+        <span class="kn">from</span> <span class="nn">sas.models.SquareWellStructure</span> <span class="kn">import</span> <span class="n">SquareWellStructure</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">SquareWellStructure</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">SquareWellStructure</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">struct_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">SquareWellStructure</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">SquareWellStructure</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.HardsphereStructure</span> <span class="kn">import</span> <span class="n">HardsphereStructure</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">HardsphereStructure</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">HardsphereStructure</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">struct_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">HardsphereStructure</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">HardsphereStructure</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+         
+        <span class="kn">from</span> <span class="nn">sas.models.StickyHSStructure</span> <span class="kn">import</span> <span class="n">StickyHSStructure</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">StickyHSStructure</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">StickyHSStructure</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">struct_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">StickyHSStructure</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">StickyHSStructure</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.HayterMSAStructure</span> <span class="kn">import</span> <span class="n">HayterMSAStructure</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">HayterMSAStructure</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">HayterMSAStructure</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">struct_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">HayterMSAStructure</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">HayterMSAStructure</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+
+        <span class="c">##shape-independent models</span>
+        <span class="kn">from</span> <span class="nn">sas.models.PowerLawAbsModel</span> <span class="kn">import</span> <span class="n">PowerLawAbsModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">PowerLawAbsModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">PowerLawAbsModel</span>
+<span class="c">#        self.shape_indep_list.append(PowerLawAbsModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">PowerLawAbsModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.BEPolyelectrolyte</span> <span class="kn">import</span> <span class="n">BEPolyelectrolyte</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">BEPolyelectrolyte</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">BEPolyelectrolyte</span>
+<span class="c">#        self.shape_indep_list.append(BEPolyelectrolyte)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">BEPolyelectrolyte</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">form_factor_dict</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">())]</span> <span class="o">=</span>  <span class="p">[</span><span class="n">SphereModel</span><span class="p">]</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.BroadPeakModel</span> <span class="kn">import</span> <span class="n">BroadPeakModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">BroadPeakModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">BroadPeakModel</span>
+<span class="c">#        self.shape_indep_list.append(BroadPeakModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">BroadPeakModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.CorrLengthModel</span> <span class="kn">import</span> <span class="n">CorrLengthModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">CorrLengthModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">CorrLengthModel</span>
+<span class="c">#        self.shape_indep_list.append(CorrLengthModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">CorrLengthModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.DABModel</span> <span class="kn">import</span> <span class="n">DABModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">DABModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">DABModel</span>
+<span class="c">#        self.shape_indep_list.append(DABModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">DABModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.DebyeModel</span> <span class="kn">import</span> <span class="n">DebyeModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">DebyeModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">DebyeModel</span>
+<span class="c">#        self.shape_indep_list.append(DebyeModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">DebyeModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.FractalModel</span> <span class="kn">import</span> <span class="n">FractalModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">FractalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">FractalModel</span>
+<span class="c">#        self.shape_indep_list.append(FractalModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">FractalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.FractalCoreShellModel</span> <span class="kn">import</span> <span class="n">FractalCoreShellModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">FractalCoreShellModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">FractalCoreShellModel</span>
+<span class="c">#        self.shape_indep_list.append(FractalCoreShellModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">FractalCoreShellModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.GaussLorentzGelModel</span> <span class="kn">import</span> <span class="n">GaussLorentzGelModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">GaussLorentzGelModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">GaussLorentzGelModel</span>
+<span class="c">#        self.shape_indep_list.append(GaussLorentzGelModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">GaussLorentzGelModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+                
+        <span class="kn">from</span> <span class="nn">sas.models.GuinierModel</span> <span class="kn">import</span> <span class="n">GuinierModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">GuinierModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">GuinierModel</span>
+<span class="c">#        self.shape_indep_list.append(GuinierModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">GuinierModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.GuinierPorodModel</span> <span class="kn">import</span> <span class="n">GuinierPorodModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">GuinierPorodModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">GuinierPorodModel</span>
+<span class="c">#        self.shape_indep_list.append(GuinierPorodModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">GuinierPorodModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.LorentzModel</span> <span class="kn">import</span> <span class="n">LorentzModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">LorentzModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">LorentzModel</span>
+<span class="c">#        self.shape_indep_list.append(LorentzModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">LorentzModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.MassFractalModel</span> <span class="kn">import</span> <span class="n">MassFractalModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">MassFractalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">MassFractalModel</span>
+<span class="c">#        self.shape_indep_list.append(MassFractalModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">MassFractalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.MassSurfaceFractal</span> <span class="kn">import</span> <span class="n">MassSurfaceFractal</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">MassSurfaceFractal</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">MassSurfaceFractal</span>
+<span class="c">#        self.shape_indep_list.append(MassSurfaceFractal)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">MassSurfaceFractal</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.PeakGaussModel</span> <span class="kn">import</span> <span class="n">PeakGaussModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">PeakGaussModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">PeakGaussModel</span>
+<span class="c">#        self.shape_indep_list.append(PeakGaussModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">PeakGaussModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.PeakLorentzModel</span> <span class="kn">import</span> <span class="n">PeakLorentzModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">PeakLorentzModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">PeakLorentzModel</span>
+<span class="c">#        self.shape_indep_list.append(PeakLorentzModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">PeakLorentzModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.Poly_GaussCoil</span> <span class="kn">import</span> <span class="n">Poly_GaussCoil</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">Poly_GaussCoil</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">Poly_GaussCoil</span>
+<span class="c">#        self.shape_indep_list.append(Poly_GaussCoil)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Poly_GaussCoil</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.PolymerExclVolume</span> <span class="kn">import</span> <span class="n">PolymerExclVolume</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">PolymerExclVolume</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">PolymerExclVolume</span>
+<span class="c">#        self.shape_indep_list.append(PolymerExclVolume)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">PolymerExclVolume</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.PorodModel</span> <span class="kn">import</span> <span class="n">PorodModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">PorodModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">PorodModel</span>
+<span class="c">#        self.shape_indep_list.append(PorodModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">PorodModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.RPA10Model</span> <span class="kn">import</span> <span class="n">RPA10Model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">RPA10Model</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">RPA10Model</span>
+<span class="c">#        self.shape_indep_list.append(RPA10Model)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multi_func_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">RPA10Model</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.StarPolymer</span> <span class="kn">import</span> <span class="n">StarPolymer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">StarPolymer</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">StarPolymer</span>
+<span class="c">#        self.shape_indep_list.append(StarPolymer)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">StarPolymer</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.SurfaceFractalModel</span> <span class="kn">import</span> <span class="n">SurfaceFractalModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">SurfaceFractalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">SurfaceFractalModel</span>
+<span class="c">#        self.shape_indep_list.append(SurfaceFractalModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">SurfaceFractalModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.TeubnerStreyModel</span> <span class="kn">import</span> <span class="n">TeubnerStreyModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">TeubnerStreyModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">TeubnerStreyModel</span>
+<span class="c">#        self.shape_indep_list.append(TeubnerStreyModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">TeubnerStreyModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.TwoLorentzianModel</span> <span class="kn">import</span> <span class="n">TwoLorentzianModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">TwoLorentzianModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">TwoLorentzianModel</span>
+<span class="c">#        self.shape_indep_list.append(TwoLorentzianModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">TwoLorentzianModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.TwoPowerLawModel</span> <span class="kn">import</span> <span class="n">TwoPowerLawModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">TwoPowerLawModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">TwoPowerLawModel</span>
+<span class="c">#        self.shape_indep_list.append(TwoPowerLawModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">TwoPowerLawModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.UnifiedPowerRgModel</span> <span class="kn">import</span> <span class="n">UnifiedPowerRgModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">UnifiedPowerRgModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">UnifiedPowerRgModel</span>
+<span class="c">#        self.shape_indep_list.append(UnifiedPowerRgModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multi_func_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">UnifiedPowerRgModel</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.LineModel</span> <span class="kn">import</span> <span class="n">LineModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">LineModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">LineModel</span>
+<span class="c">#        self.shape_indep_list.append(LineModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">LineModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.ReflectivityModel</span> <span class="kn">import</span> <span class="n">ReflectivityModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">ReflectivityModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">ReflectivityModel</span>
+<span class="c">#        self.shape_indep_list.append(ReflectivityModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multi_func_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ReflectivityModel</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.ReflectivityIIModel</span> <span class="kn">import</span> <span class="n">ReflectivityIIModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">ReflectivityIIModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">ReflectivityIIModel</span>
+<span class="c">#        self.shape_indep_list.append(ReflectivityIIModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multi_func_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ReflectivityIIModel</span><span class="p">)</span>
+        
+        <span class="kn">from</span> <span class="nn">sas.models.GelFitModel</span> <span class="kn">import</span> <span class="n">GelFitModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">GelFitModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">GelFitModel</span>
+<span class="c">#        self.shape_indep_list.append(GelFitModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">GelFitModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.PringlesModel</span> <span class="kn">import</span> <span class="n">PringlesModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">PringlesModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">PringlesModel</span>
+<span class="c">#        self.shape_indep_list.append(PringlesModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">PringlesModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.RectangularPrismModel</span> <span class="kn">import</span> <span class="n">RectangularPrismModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">RectangularPrismModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">RectangularPrismModel</span>
+<span class="c">#        self.shape_list.append(RectangularPrismModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">RectangularPrismModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">RectangularPrismModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.RectangularHollowPrismInfThinWallsModel</span> <span class="kn">import</span> <span class="n">RectangularHollowPrismInfThinWallsModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">RectangularHollowPrismInfThinWallsModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">RectangularHollowPrismInfThinWallsModel</span>
+<span class="c">#        self.shape_list.append(RectangularHollowPrismInfThinWallsModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">RectangularHollowPrismInfThinWallsModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">RectangularHollowPrismInfThinWallsModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.RectangularHollowPrismModel</span> <span class="kn">import</span> <span class="n">RectangularHollowPrismModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">RectangularHollowPrismModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">RectangularHollowPrismModel</span>
+<span class="c">#        self.shape_list.append(RectangularHollowPrismModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">RectangularHollowPrismModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">RectangularHollowPrismModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+        <span class="kn">from</span> <span class="nn">sas.models.MicelleSphCoreModel</span> <span class="kn">import</span> <span class="n">MicelleSphCoreModel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">MicelleSphCoreModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">MicelleSphCoreModel</span>
+<span class="c">#        self.shape_list.append(MicelleSphCoreModel)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">MicelleSphCoreModel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">MicelleSphCoreModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+
+
+        <span class="c">#from sas.models.FractalO_Z import FractalO_Z</span>
+        <span class="c">#self.model_dictionary[FractalO_Z.__name__] = FractalO_Z</span>
+        <span class="c">#self.shape_indep_list.append(FractalO_Z)</span>
+        <span class="c">#self.model_name_list.append(FractalO_Z.__name__)</span>
+    
+        <span class="c">#Looking for plugins</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">stored_plugins</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">findModels</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plugins</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">stored_plugins</span><span class="o">.</span><span class="n">values</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">plug</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">stored_plugins</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">plug</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">_get_multifunc_models</span><span class="p">()</span>
+       
+        <span class="k">return</span> <span class="mi">0</span>
+
+<div class="viewcode-block" id="ModelManagerBase.is_changed"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManagerBase.is_changed">[docs]</a>    <span class="k">def</span> <span class="nf">is_changed</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        check the last time the plugin dir has changed and return true</span>
+<span class="sd">         is the directory was modified else return false</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">plugin_dir</span> <span class="o">=</span> <span class="n">find_plugins_dir</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">plugin_dir</span><span class="p">):</span>
+            <span class="n">temp</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">getmtime</span><span class="p">(</span><span class="n">plugin_dir</span><span class="p">)</span>
+            <span class="k">if</span>  <span class="bp">self</span><span class="o">.</span><span class="n">last_time_dir_modified</span> <span class="o">!=</span> <span class="n">temp</span><span class="p">:</span>
+                <span class="n">is_modified</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">last_time_dir_modified</span> <span class="o">=</span> <span class="n">temp</span>
+        
+        <span class="k">return</span> <span class="n">is_modified</span>
+    </div>
+<div class="viewcode-block" id="ModelManagerBase.update"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManagerBase.update">[docs]</a>    <span class="k">def</span> <span class="nf">update</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return a dictionary of model if</span>
+<span class="sd">        new models were added else return empty dictionary</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">new_plugins</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">findModels</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">new_plugins</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">plug</span> <span class="ow">in</span>  <span class="n">new_plugins</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">stored_plugins</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">stored_plugins</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">plug</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">plugins</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">plug</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">plug</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_combobox</span><span class="o">.</span><span class="n">set_list</span><span class="p">(</span><span class="s">&quot;Customized Models&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">plugins</span><span class="p">)</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_combobox</span><span class="o">.</span><span class="n">get_list</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="p">{}</span>
+    </div>
+<div class="viewcode-block" id="ModelManagerBase.pulgins_reset"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManagerBase.pulgins_reset">[docs]</a>    <span class="k">def</span> <span class="nf">pulgins_reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return a dictionary of model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plugins</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">new_plugins</span> <span class="o">=</span> <span class="n">_findModels</span><span class="p">(</span><span class="nb">dir</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">plug</span> <span class="ow">in</span>  <span class="n">new_plugins</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="k">for</span> <span class="n">stored_name</span><span class="p">,</span> <span class="n">stored_plug</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">stored_plugins</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="n">stored_name</span><span class="p">:</span>
+                    <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">stored_plugins</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
+                    <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
+                    <span class="k">break</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">stored_plugins</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">plug</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">plugins</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">plug</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">plug</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_combobox</span><span class="o">.</span><span class="n">reset_list</span><span class="p">(</span><span class="s">&quot;Customized Models&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">plugins</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_combobox</span><span class="o">.</span><span class="n">get_list</span><span class="p">()</span>
+       
+<span class="c">##   I believe the next four methods are for the old form factor GUI</span>
+<span class="c">##   where the dropdown showed a list of categories which then rolled out</span>
+<span class="c">##   in a second dropdown to the side. Some testing shows they indeed no longer</span>
+<span class="c">##   seem to be called.  If no problems are found during testing of release we</span>
+<span class="c">##   can remove this huge chunck of stuff.</span>
+<span class="c">##</span>
+<span class="c">##   -PDB  April 26, 2014</span>
+
+<span class="c">#   def populate_menu(self, modelmenu, event_owner):</span>
+<span class="c">#       &quot;&quot;&quot;</span>
+<span class="c">#       Populate a menu with our models</span>
+<span class="c">#       </span>
+<span class="c">#       :param id: first menu event ID to use when binding the menu events</span>
+<span class="c">#       :param modelmenu: wx.Menu object to populate</span>
+<span class="c">#       :param event_owner: wx object to bind the menu events to</span>
+<span class="c">#       </span>
+<span class="c">#       :return: the next free event ID following the new menu events</span>
+<span class="c">#       </span>
+<span class="c">#       &quot;&quot;&quot;</span>
+<span class="c"># </span>
+        <span class="c">## Fill model lists</span>
+<span class="c">#        self._getModelList()</span>
+        <span class="c">## store reference to model menu of guiframe</span>
+<span class="c">#        self.modelmenu = modelmenu</span>
+        <span class="c">## guiframe reference</span>
+<span class="c">#        self.event_owner = event_owner</span>
+        
+<span class="c">#        shape_submenu = wx.Menu()</span>
+<span class="c">#        shape_indep_submenu = wx.Menu()</span>
+<span class="c">#        structure_factor = wx.Menu()</span>
+<span class="c">#        added_models = wx.Menu()</span>
+<span class="c">#        multip_models = wx.Menu()</span>
+        <span class="c">## create menu with shape</span>
+<span class="c">#        self._fill_simple_menu(menuinfo=[&quot;Shapes&quot;,</span>
+<span class="c">#                                         shape_submenu,</span>
+<span class="c">#                                         &quot; simple shape&quot;],</span>
+<span class="c">#                         list1=self.shape_list)</span>
+        
+<span class="c">#        self._fill_simple_menu(menuinfo=[&quot;Shape-Independent&quot;,</span>
+<span class="c">#                                         shape_indep_submenu,</span>
+<span class="c">#                                         &quot;List of shape-independent models&quot;],</span>
+<span class="c">#                         list1=self.shape_indep_list)</span>
+        
+<span class="c">#        self._fill_simple_menu(menuinfo=[&quot;Structure Factors&quot;,</span>
+<span class="c">#                                         structure_factor,</span>
+<span class="c">#                                         &quot;List of Structure factors models&quot;],</span>
+<span class="c">#                                list1=self.struct_list)</span>
+        
+<span class="c">#        self._fill_plugin_menu(menuinfo=[&quot;Customized Models&quot;, added_models,</span>
+<span class="c">#                                            &quot;List of additional models&quot;],</span>
+<span class="c">#                                 list1=self.plugins)</span>
+        
+<span class="c">#        self._fill_menu(menuinfo=[&quot;P(Q)*S(Q)&quot;, multip_models,</span>
+<span class="c">#                                  &quot;mulplication of 2 models&quot;],</span>
+<span class="c">#                                   list1=self.multiplication_factor,</span>
+<span class="c">#                                   list2=self.struct_list)</span>
+<span class="c">#        return 0</span>
+    
+<span class="c">#    def _fill_plugin_menu(self, menuinfo, list1):</span>
+<span class="c">#        &quot;&quot;&quot;</span>
+<span class="c">#        fill the plugin menu with costumized models</span>
+<span class="c">#        &quot;&quot;&quot;</span>
+<span class="c">#        print (&quot;got to fill plugin menu&quot;)</span>
+<span class="c">#        if len(list1) == 0:</span>
+<span class="c">#            id = wx.NewId()</span>
+<span class="c">#            msg = &quot;No model available check plugins.log for errors to fix problem&quot;</span>
+<span class="c">#            menuinfo[1].Append(int(id), &quot;Empty&quot;, msg)</span>
+<span class="c">#        self._fill_simple_menu(menuinfo, list1)</span>
+        
+<span class="c">#   def _fill_simple_menu(self, menuinfo, list1):</span>
+<span class="c">#       &quot;&quot;&quot;</span>
+<span class="c">#       Fill the menu with list item</span>
+<span class="c">#       </span>
+<span class="c">#       :param modelmenu: the menu to fill</span>
+<span class="c">#       :param menuinfo: submenu item for the first column of this modelmenu</span>
+<span class="c">#                        with info.Should be a list :</span>
+<span class="c">#                        [name(string) , menu(wx.menu), help(string)]</span>
+<span class="c">#       :param list1: contains item (form factor )to fill modelmenu second column</span>
+<span class="c">#       </span>
+<span class="c">#       &quot;&quot;&quot;</span>
+<span class="c">#       if len(list1) &gt; 0:</span>
+<span class="c">#           self.model_combobox.set_list(menuinfo[0], list1)</span>
+            
+<span class="c">#            for item in list1:</span>
+<span class="c">#                try:</span>
+<span class="c">#                    id = wx.NewId()</span>
+<span class="c">#                    struct_factor = item()</span>
+<span class="c">#                    struct_name = struct_factor.__class__.__name__</span>
+<span class="c">#                    if hasattr(struct_factor, &quot;name&quot;):</span>
+<span class="c">#                        struct_name = struct_factor.name</span>
+<span class="c">#                        </span>
+<span class="c">#                    menuinfo[1].Append(int(id), struct_name, struct_name)</span>
+<span class="c">#                    if not  item in self.struct_factor_dict.itervalues():</span>
+<span class="c">#                        self.struct_factor_dict[str(id)] = item</span>
+<span class="c">#                    wx.EVT_MENU(self.event_owner, int(id), self._on_model)</span>
+<span class="c">#                except:</span>
+<span class="c">#                    msg = &quot;Error Occured: %s&quot; % sys.exc_value</span>
+<span class="c">#                    wx.PostEvent(self.event_owner, StatusEvent(status=msg))</span>
+<span class="c">#                </span>
+<span class="c">#        id = wx.NewId()</span>
+<span class="c">#        self.modelmenu.AppendMenu(id, menuinfo[0], menuinfo[1], menuinfo[2])</span>
+<span class="c">#        </span>
+<span class="c">#    def _fill_menu(self, menuinfo, list1, list2):</span>
+<span class="c">#        &quot;&quot;&quot;</span>
+<span class="c">#        Fill the menu with list item</span>
+<span class="c">#        </span>
+<span class="c">#        :param menuinfo: submenu item for the first column of this modelmenu</span>
+<span class="c">#                         with info.Should be a list :</span>
+<span class="c">#                         [name(string) , menu(wx.menu), help(string)]</span>
+<span class="c">#        :param list1: contains item (form factor )to fill modelmenu second column</span>
+<span class="c">#        :param list2: contains item (Structure factor )to fill modelmenu</span>
+<span class="c">#                third column</span>
+<span class="c">#                </span>
+<span class="c">#        &quot;&quot;&quot;</span>
+<span class="c">#        if len(list1) &gt; 0:</span>
+<span class="c">#            self.model_combobox.set_list(menuinfo[0], list1)</span>
+<span class="c">#            </span>
+<span class="c">#            for item in list1:</span>
+<span class="c">#                form_factor = item()</span>
+<span class="c">#                form_name = form_factor.__class__.__name__</span>
+<span class="c">#                if hasattr(form_factor, &quot;name&quot;):</span>
+<span class="c">#                    form_name = form_factor.name</span>
+<span class="c">#                ### store form factor to return to other users</span>
+<span class="c">#                newmenu = wx.Menu()</span>
+<span class="c">#                if len(list2) &gt; 0:</span>
+<span class="c">#                    for model  in list2:</span>
+<span class="c">#                        id = wx.NewId()</span>
+<span class="c">#                        struct_factor = model()</span>
+<span class="c">#                        name = struct_factor.__class__.__name__</span>
+<span class="c">#                        if hasattr(struct_factor, &quot;name&quot;):</span>
+<span class="c">#                            name = struct_factor.name</span>
+<span class="c">#                        newmenu.Append(id, name, name)</span>
+<span class="c">#                        wx.EVT_MENU(self.event_owner, int(id), self._on_model)</span>
+<span class="c">#                        ## save form_fact and struct_fact</span>
+<span class="c">#                        self.form_factor_dict[int(id)] = [form_factor,</span>
+<span class="c">#                                                          struct_factor]</span>
+<span class="c">#                        </span>
+<span class="c">#                form_id = wx.NewId()</span>
+<span class="c">#                menuinfo[1].AppendMenu(int(form_id), form_name,</span>
+<span class="c">#                                       newmenu, menuinfo[2])</span>
+<span class="c">#        id = wx.NewId()</span>
+<span class="c">#        self.modelmenu.AppendMenu(id, menuinfo[0], menuinfo[1], menuinfo[2])</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_on_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        React to a model menu event</span>
+<span class="sd">        </span>
+<span class="sd">        :param event: wx menu event</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">int</span><span class="p">(</span><span class="n">evt</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">form_factor_dict</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="kn">from</span> <span class="nn">sas.models.MultiplicationModel</span> <span class="kn">import</span> <span class="n">MultiplicationModel</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span><span class="p">[</span><span class="n">MultiplicationModel</span><span class="o">.</span><span class="n">__name__</span><span class="p">]</span> <span class="o">=</span> <span class="n">MultiplicationModel</span>
+            <span class="n">model1</span><span class="p">,</span> <span class="n">model2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">form_factor_dict</span><span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="n">evt</span><span class="o">.</span><span class="n">GetId</span><span class="p">())]</span>
+            <span class="n">model</span> <span class="o">=</span> <span class="n">MultiplicationModel</span><span class="p">(</span><span class="n">model1</span><span class="p">,</span> <span class="n">model2</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">struct_factor_dict</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">evt</span><span class="o">.</span><span class="n">GetId</span><span class="p">())]()</span>
+        
+        <span class="c">#TODO: investigate why the following two lines were left in the code</span>
+        <span class="c">#      even though the ModelEvent class doesn&#39;t exist</span>
+        <span class="c">#evt = ModelEvent(model=model)</span>
+        <span class="c">#wx.PostEvent(self.event_owner, evt)</span>
+        
+    <span class="k">def</span> <span class="nf">_get_multifunc_models</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the multifunctional models</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">plugins</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="c"># check the multiplicity if any</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">multiplicity_info</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">multi_func_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="c"># pass to other items</span>
+                <span class="k">pass</span>
+                    
+<div class="viewcode-block" id="ModelManagerBase.get_model_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManagerBase.get_model_list">[docs]</a>    <span class="k">def</span> <span class="nf">get_model_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return dictionary of models for fitpanel use</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Model_list now only contains attribute lists not category list.</span>
+        <span class="c">## Eventually this should be in one master list -- read in category</span>
+        <span class="c">## list then pull those models that exist and get attributes then add</span>
+        <span class="c">## to list ..and if model does not exist remove from list as now</span>
+        <span class="c">## and update json file.</span>
+        <span class="c">##</span>
+        <span class="c">## -PDB   April 26, 2014</span>
+        
+<span class="c">#        self.model_combobox.set_list(&quot;Shapes&quot;, self.shape_list)</span>
+<span class="c">#        self.model_combobox.set_list(&quot;Shape-Independent&quot;,</span>
+<span class="c">#                                     self.shape_indep_list)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_combobox</span><span class="o">.</span><span class="n">set_list</span><span class="p">(</span><span class="s">&quot;Structure Factors&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">struct_list</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_combobox</span><span class="o">.</span><span class="n">set_list</span><span class="p">(</span><span class="s">&quot;Customized Models&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">plugins</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_combobox</span><span class="o">.</span><span class="n">set_list</span><span class="p">(</span><span class="s">&quot;P(Q)*S(Q)&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_combobox</span><span class="o">.</span><span class="n">set_list</span><span class="p">(</span><span class="s">&quot;multiplication&quot;</span><span class="p">,</span>
+                                     <span class="bp">self</span><span class="o">.</span><span class="n">multiplication_factor</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_combobox</span><span class="o">.</span><span class="n">set_list</span><span class="p">(</span><span class="s">&quot;Multi-Functions&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">multi_func_list</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_combobox</span><span class="o">.</span><span class="n">get_list</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="ModelManagerBase.get_model_name_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManagerBase.get_model_name_list">[docs]</a>    <span class="k">def</span> <span class="nf">get_model_name_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return regular model name list</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_name_list</span>
+</div>
+<div class="viewcode-block" id="ModelManagerBase.get_model_dictionary"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManagerBase.get_model_dictionary">[docs]</a>    <span class="k">def</span> <span class="nf">get_model_dictionary</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return dictionary linking model names to objects</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_dictionary</span>
+  
+        </div></div>
+<div class="viewcode-block" id="ModelManager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManager">[docs]</a><span class="k">class</span> <span class="nc">ModelManager</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    implement model</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">__modelmanager</span> <span class="o">=</span> <span class="n">ModelManagerBase</span><span class="p">()</span>
+    <span class="n">cat_model_list</span> <span class="o">=</span> <span class="p">[</span><span class="n">model_name</span> <span class="k">for</span> <span class="n">model_name</span> \
+                      <span class="ow">in</span> <span class="n">__modelmanager</span><span class="o">.</span><span class="n">model_dictionary</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span> \
+                      <span class="k">if</span> <span class="n">model_name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">__modelmanager</span><span class="o">.</span><span class="n">stored_plugins</span><span class="o">.</span><span class="n">keys</span><span class="p">()]</span>
+
+    <span class="n">CategoryInstaller</span><span class="o">.</span><span class="n">check_install</span><span class="p">(</span><span class="n">model_list</span><span class="o">=</span><span class="n">cat_model_list</span><span class="p">)</span>
+<div class="viewcode-block" id="ModelManager.findModels"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManager.findModels">[docs]</a>    <span class="k">def</span> <span class="nf">findModels</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__modelmanager</span><span class="o">.</span><span class="n">findModels</span><span class="p">()</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_getModelList</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__modelmanager</span><span class="o">.</span><span class="n">_getModelList</span><span class="p">()</span>
+    
+<div class="viewcode-block" id="ModelManager.is_changed"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManager.is_changed">[docs]</a>    <span class="k">def</span> <span class="nf">is_changed</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__modelmanager</span><span class="o">.</span><span class="n">is_changed</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="ModelManager.update"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManager.update">[docs]</a>    <span class="k">def</span> <span class="nf">update</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__modelmanager</span><span class="o">.</span><span class="n">update</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="ModelManager.pulgins_reset"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManager.pulgins_reset">[docs]</a>    <span class="k">def</span> <span class="nf">pulgins_reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__modelmanager</span><span class="o">.</span><span class="n">pulgins_reset</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="ModelManager.populate_menu"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManager.populate_menu">[docs]</a>    <span class="k">def</span> <span class="nf">populate_menu</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">modelmenu</span><span class="p">,</span> <span class="n">event_owner</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__modelmanager</span><span class="o">.</span><span class="n">populate_menu</span><span class="p">(</span><span class="n">modelmenu</span><span class="p">,</span> <span class="n">event_owner</span><span class="p">)</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_on_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__modelmanager</span><span class="o">.</span><span class="n">_on_model</span><span class="p">(</span><span class="n">evt</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_get_multifunc_models</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__modelmanager</span><span class="o">.</span><span class="n">_get_multifunc_models</span><span class="p">()</span>
+    
+<div class="viewcode-block" id="ModelManager.get_model_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManager.get_model_list">[docs]</a>    <span class="k">def</span> <span class="nf">get_model_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__modelmanager</span><span class="o">.</span><span class="n">get_model_list</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="ModelManager.get_model_name_list"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManager.get_model_name_list">[docs]</a>    <span class="k">def</span> <span class="nf">get_model_name_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__modelmanager</span><span class="o">.</span><span class="n">get_model_name_list</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="ModelManager.get_model_dictionary"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.models.ModelManager.get_model_dictionary">[docs]</a>    <span class="k">def</span> <span class="nf">get_model_dictionary</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__modelmanager</span><span class="o">.</span><span class="n">get_model_dictionary</span><span class="p">()</span></div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/pagestate.html
===================================================================
--- _modules/sas/perspectives/fitting/pagestate.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/pagestate.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,1859 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.pagestate &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.pagestate</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Class that holds a fit page state</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation.</span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">copy</span>
+<span class="kn">import</span> <span class="nn">logging</span>
+<span class="kn">import</span> <span class="nn">numpy</span>
+<span class="kn">import</span> <span class="nn">string</span>
+
+<span class="kn">import</span> <span class="nn">xml.dom.minidom</span>
+<span class="kn">from</span> <span class="nn">xml.dom.minidom</span> <span class="kn">import</span> <span class="n">parseString</span>
+<span class="kn">from</span> <span class="nn">lxml</span> <span class="kn">import</span> <span class="n">etree</span>
+
+<span class="kn">import</span> <span class="nn">sas.dataloader</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.readers.cansas_reader</span> <span class="kn">import</span> <span class="n">Reader</span> <span class="k">as</span> <span class="n">CansasReader</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.readers.cansas_reader</span> <span class="kn">import</span> <span class="n">get_content</span><span class="p">,</span> <span class="n">write_node</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Data2D</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Collimation</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Detector</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Process</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.data_info</span> <span class="kn">import</span> <span class="n">Aperture</span>
+<span class="c">#Information to read/write state as xml</span>
+<span class="n">FITTING_NODE_NAME</span> <span class="o">=</span> <span class="s">&#39;fitting_plug_in&#39;</span>
+<span class="n">CANSAS_NS</span> <span class="o">=</span> <span class="s">&quot;cansas1d/1.0&quot;</span>
+
+<span class="n">list_of_data_attributes</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&quot;is_data&quot;</span><span class="p">,</span> <span class="s">&quot;is_data&quot;</span><span class="p">,</span> <span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;group_id&quot;</span><span class="p">,</span> <span class="s">&quot;data_group_id&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;data_name&quot;</span><span class="p">,</span> <span class="s">&quot;data_name&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;data_id&quot;</span><span class="p">,</span> <span class="s">&quot;data_id&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;data_name&quot;</span><span class="p">,</span> <span class="s">&quot;data_name&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">]]</span>
+<span class="n">list_of_state_attributes</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&quot;engine_type&quot;</span><span class="p">,</span> <span class="s">&quot;engine_type&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                       <span class="p">[</span><span class="s">&quot;qmin&quot;</span><span class="p">,</span> <span class="s">&quot;qmin&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;qmax&quot;</span><span class="p">,</span> <span class="s">&quot;qmax&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;npts&quot;</span><span class="p">,</span> <span class="s">&quot;npts&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                      <span class="c">#[&quot;shape_rbutton&quot;, &quot;shape_rbutton&quot;, &quot;bool&quot;],</span>
+                      <span class="c">#[&quot;shape_indep_rbutton&quot;, &quot;shape_indep_rbutton&quot;, &quot;bool&quot;],</span>
+                      <span class="c">#[&quot;plugin_rbutton&quot;, &quot;plugin_rbutton&quot;, &quot;bool&quot;],</span>
+                      <span class="c">#[&quot;struct_rbutton&quot;, &quot;struct_rbutton&quot;, &quot;bool&quot;],</span>
+                      <span class="p">[</span><span class="s">&quot;categorycombobox&quot;</span><span class="p">,</span> <span class="s">&quot;categorycombobox&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;formfactorcombobox&quot;</span><span class="p">,</span> <span class="s">&quot;formfactorcombobox&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;structurecombobox&quot;</span><span class="p">,</span> <span class="s">&quot;structurecombobox&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;multi_factor&quot;</span><span class="p">,</span><span class="s">&quot;multi_factor&quot;</span><span class="p">,</span><span class="s">&quot;float&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;magnetic_on&quot;</span><span class="p">,</span><span class="s">&quot;magnetic_on&quot;</span><span class="p">,</span> <span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;enable_smearer&quot;</span><span class="p">,</span><span class="s">&quot;enable_smearer&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;disable_smearer&quot;</span><span class="p">,</span><span class="s">&quot;disable_smearer&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;pinhole_smearer&quot;</span><span class="p">,</span><span class="s">&quot;pinhole_smearer&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;slit_smearer&quot;</span><span class="p">,</span><span class="s">&quot;slit_smearer&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;enable_disp&quot;</span><span class="p">,</span><span class="s">&quot;enable_disp&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;disable_disp&quot;</span><span class="p">,</span><span class="s">&quot;disable_disp&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;dI_noweight&quot;</span><span class="p">,</span><span class="s">&quot;dI_noweight&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;dI_didata&quot;</span><span class="p">,</span><span class="s">&quot;dI_didata&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;dI_sqrdata&quot;</span><span class="p">,</span><span class="s">&quot;dI_sqrdata&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;dI_idata&quot;</span><span class="p">,</span><span class="s">&quot;dI_idata&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;enable2D&quot;</span><span class="p">,</span><span class="s">&quot;enable2D&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;cb1&quot;</span><span class="p">,</span><span class="s">&quot;cb1&quot;</span><span class="p">,</span><span class="s">&quot;bool&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;tcChi&quot;</span><span class="p">,</span><span class="s">&quot;tcChi&quot;</span><span class="p">,</span><span class="s">&quot;float&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;smearer&quot;</span><span class="p">,</span> <span class="s">&quot;smearer&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;smear_type&quot;</span><span class="p">,</span><span class="s">&quot;smear_type&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;dq_l&quot;</span><span class="p">,</span> <span class="s">&quot;dq_l&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;dq_r&quot;</span><span class="p">,</span><span class="s">&quot;dq_r&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;dx_max&quot;</span><span class="p">,</span> <span class="s">&quot;dx_max&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;dx_min&quot;</span><span class="p">,</span><span class="s">&quot;dx_min&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;dxl&quot;</span><span class="p">,</span> <span class="s">&quot;dxl&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                      <span class="p">[</span><span class="s">&quot;dxw&quot;</span><span class="p">,</span><span class="s">&quot;dxw&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">]]</span>
+
+<span class="n">list_of_model_attributes</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&quot;values&quot;</span><span class="p">,</span> <span class="s">&quot;values&quot;</span><span class="p">],</span>
+                            <span class="p">[</span><span class="s">&quot;weights&quot;</span><span class="p">,</span> <span class="s">&quot;weights&quot;</span><span class="p">]]</span>
+
+<span class="n">list_of_obj_dic</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&quot;disp_obj_dict&quot;</span><span class="p">,</span> <span class="s">&quot;_disp_obj_dict&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">]]</span>
+
+<span class="n">list_of_state_parameters</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&quot;parameters&quot;</span><span class="p">,</span> <span class="s">&quot;parameters&quot;</span><span class="p">],</span>
+                            <span class="p">[</span><span class="s">&quot;str_parameters&quot;</span><span class="p">,</span> <span class="s">&quot;str_parameters&quot;</span><span class="p">],</span>
+                            <span class="p">[</span><span class="s">&quot;orientation_parameters&quot;</span><span class="p">,</span> <span class="s">&quot;orientation_params&quot;</span><span class="p">],</span>
+                            <span class="p">[</span><span class="s">&quot;dispersity_parameters&quot;</span><span class="p">,</span> <span class="s">&quot;orientation_params_disp&quot;</span><span class="p">],</span>
+                            <span class="p">[</span><span class="s">&quot;fixed_param&quot;</span><span class="p">,</span> <span class="s">&quot;fixed_param&quot;</span><span class="p">],</span>
+                            <span class="p">[</span><span class="s">&quot;fittable_param&quot;</span><span class="p">,</span> <span class="s">&quot;fittable_param&quot;</span><span class="p">]]</span>
+<span class="n">list_of_data_2d_attr</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&quot;xmin&quot;</span><span class="p">,</span> <span class="s">&quot;xmin&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                        <span class="p">[</span><span class="s">&quot;xmax&quot;</span><span class="p">,</span> <span class="s">&quot;xmax&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                        <span class="p">[</span><span class="s">&quot;ymin&quot;</span><span class="p">,</span> <span class="s">&quot;ymin&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                        <span class="p">[</span><span class="s">&quot;ymax&quot;</span><span class="p">,</span> <span class="s">&quot;ymax&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                        <span class="p">[</span><span class="s">&quot;_xaxis&quot;</span><span class="p">,</span> <span class="s">&quot;_xaxis&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                        <span class="p">[</span><span class="s">&quot;_xunit&quot;</span><span class="p">,</span> <span class="s">&quot;_xunit&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                        <span class="p">[</span><span class="s">&quot;_yaxis&quot;</span><span class="p">,</span> <span class="s">&quot;_yaxis&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                        <span class="p">[</span><span class="s">&quot;_yunit&quot;</span><span class="p">,</span> <span class="s">&quot;_yunit&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                        <span class="p">[</span><span class="s">&quot;_zaxis&quot;</span><span class="p">,</span> <span class="s">&quot;_zaxis&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">],</span>
+                        <span class="p">[</span><span class="s">&quot;_zunit&quot;</span><span class="p">,</span> <span class="s">&quot;_zunit&quot;</span><span class="p">,</span> <span class="s">&quot;string&quot;</span><span class="p">]]</span>
+<span class="n">list_of_data2d_values</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&quot;qx_data&quot;</span><span class="p">,</span> <span class="s">&quot;qx_data&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                         <span class="p">[</span><span class="s">&quot;qy_data&quot;</span><span class="p">,</span> <span class="s">&quot;qy_data&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                         <span class="p">[</span><span class="s">&quot;dqx_data&quot;</span><span class="p">,</span> <span class="s">&quot;dqx_data&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                         <span class="p">[</span><span class="s">&quot;dqy_data&quot;</span><span class="p">,</span> <span class="s">&quot;dqy_data&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                         <span class="p">[</span><span class="s">&quot;data&quot;</span><span class="p">,</span> <span class="s">&quot;data&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                         <span class="p">[</span><span class="s">&quot;q_data&quot;</span><span class="p">,</span> <span class="s">&quot;q_data&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                         <span class="p">[</span><span class="s">&quot;err_data&quot;</span><span class="p">,</span> <span class="s">&quot;err_data&quot;</span><span class="p">,</span> <span class="s">&quot;float&quot;</span><span class="p">],</span>
+                         <span class="p">[</span><span class="s">&quot;mask&quot;</span><span class="p">,</span> <span class="s">&quot;mask&quot;</span><span class="p">,</span> <span class="s">&quot;bool&quot;</span><span class="p">]]</span>
+
+
+<div class="viewcode-block" id="parse_entry_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.parse_entry_helper">[docs]</a><span class="k">def</span> <span class="nf">parse_entry_helper</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Create a numpy list from value extrated from the node</span>
+<span class="sd">    </span>
+<span class="sd">    :param node: node from each the value is stored</span>
+<span class="sd">    :param item: list name of three strings.the two first are name of data</span>
+<span class="sd">        attribute and the third one is the type of the value of that</span>
+<span class="sd">        attribute. type can be string, float, bool, etc.</span>
+<span class="sd">    </span>
+<span class="sd">    : return: numpy array</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">if</span> <span class="n">node</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;string&quot;</span><span class="p">:</span>
+            <span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
+        <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;bool&quot;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="n">node</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;True&quot;</span>
+                
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+            
+            </div>
+<div class="viewcode-block" id="PageState"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.PageState">[docs]</a><span class="k">class</span> <span class="nc">PageState</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Contains information to reconstruct a page of the fitpanel.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">model</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialize the current state</span>
+<span class="sd">        </span>
+<span class="sd">        :param model: a selected model within a page</span>
+<span class="sd">        :param data:</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#Time of state creation</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="c">## Data member to store the dispersion object created</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c">#------------------------</span>
+        <span class="c">#Data used for fitting</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="c"># model data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">theory_data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#Is 2D</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_2D</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">images</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="c">#save additional information on data that dataloader.reader does not read</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_id</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="s">&quot;id&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_group_id</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="s">&quot;group_id&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_group_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+        
+        <span class="c">## reset True change the state of exsiting button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset</span> <span class="o">=</span> <span class="bp">False</span>
+       
+        <span class="c">#engine type</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">engine_type</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># flag to allow data2D plot</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c"># model on which the fit would be performed</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">m_name</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#list of process done to model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">process</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">#fit page manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#Store the parent of this panel parent</span>
+        <span class="c"># For this application fitpanel is the parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="c"># Event_owner is the owner of model event</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">event_owner</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">##page name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="c"># Contains link between model, all its parameters, and panel organization</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># String parameter list that can not be fitted</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># Contains list of parameters that cannot be fitted and reference to</span>
+        <span class="c">#panel objects</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fixed_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># Contains list of parameters with dispersity and reference to</span>
+        <span class="c">#panel objects</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## orientation parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## orientation parameters for gaussian dispersity</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## smearer info</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smearer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dq_l</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dq_r</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#list of dispersion parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">disp_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">getDispParamList</span><span class="p">()</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">values</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">weights</span> <span class="o">=</span> <span class="p">{}</span>
+                    
+        <span class="c">#contains link between a model and selected parameters to fit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">##dictionary of model type and model class</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_list_box</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## save the state of the context menu</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">saved_states</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c">## save selection of combobox</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">formfactorcombobox</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">categorycombobox</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">structurecombobox</span> <span class="o">=</span> <span class="bp">None</span>
+
+        <span class="c">## radio box to select type of model</span>
+        <span class="c">#self.shape_rbutton = False</span>
+        <span class="c">#self.shape_indep_rbutton = False</span>
+        <span class="c">#self.struct_rbutton = False</span>
+        <span class="c">#self.plugin_rbutton = False</span>
+        <span class="c">## the indice of the current selection</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disp_box</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">## Qrange</span>
+        <span class="c">## Q range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span> <span class="o">=</span> <span class="mf">0.001</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span> <span class="o">=</span> <span class="mf">0.1</span>
+        <span class="c">#reset data range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_x</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_x</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">## enable smearering state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c"># weighting options</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">## disperity selection</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span> <span class="o">=</span> <span class="bp">True</span>
+       
+        <span class="c">## state of selected all check button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">## store value of chisqr</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span> <span class="o">=</span> <span class="bp">None</span>
+    
+<div class="viewcode-block" id="PageState.clone"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.PageState.clone">[docs]</a>    <span class="k">def</span> <span class="nf">clone</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create a new copy of the current object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">model</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+            <span class="n">model</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">name</span>
+        <span class="n">obj</span> <span class="o">=</span> <span class="n">PageState</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">model</span><span class="o">=</span><span class="n">model</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">file</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="bp">self</span><span class="o">.</span><span class="n">file</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">data</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="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">data_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_name</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_data</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">model_list_box</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="bp">self</span><span class="o">.</span><span class="n">model_list_box</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">engine_type</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="bp">self</span><span class="o">.</span><span class="n">engine_type</span><span class="p">)</span>
+        
+        <span class="n">obj</span><span class="o">.</span><span class="n">categorycombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorycombobox</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">formfactorcombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorcombobox</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">structurecombobox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurecombobox</span>
+        
+        <span class="c">#obj.shape_rbutton = self.shape_rbutton</span>
+        <span class="c">#obj.shape_indep_rbutton = self.shape_indep_rbutton</span>
+        <span class="c">#obj.struct_rbutton = self.struct_rbutton</span>
+        <span class="c">#obj.plugin_rbutton = self.plugin_rbutton</span>
+        
+        <span class="n">obj</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">event_owner</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">event_owner</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">disp_list</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="bp">self</span><span class="o">.</span><span class="n">disp_list</span><span class="p">)</span>
+        
+        <span class="n">obj</span><span class="o">.</span><span class="n">enable2D</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="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">parameters</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="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">str_parameters</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="bp">self</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">fixed_param</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="bp">self</span><span class="o">.</span><span class="n">fixed_param</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">fittable_param</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="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">orientation_params</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="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">orientation_params_disp</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="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">enable_disp</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="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">disable_disp</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="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">tcChi</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span>
+  
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="n">obj</span><span class="o">.</span><span class="n">_disp_obj_dict</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="n">obj</span><span class="o">.</span><span class="n">disp_cb_dict</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">values</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">values</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="n">obj</span><span class="o">.</span><span class="n">values</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">weights</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">weights</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="n">obj</span><span class="o">.</span><span class="n">weights</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">enable_smearer</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="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">disable_smearer</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="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">pinhole_smearer</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="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">slit_smearer</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="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">smear_type</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="bp">self</span><span class="o">.</span><span class="n">smear_type</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dI_noweight</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="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dI_didata</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="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dI_sqrdata</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="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dI_idata</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="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dq_l</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="bp">self</span><span class="o">.</span><span class="n">dq_l</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dq_r</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="bp">self</span><span class="o">.</span><span class="n">dq_r</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dx_max</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="bp">self</span><span class="o">.</span><span class="n">dx_max</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dx_min</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="bp">self</span><span class="o">.</span><span class="n">dx_min</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dxl</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="bp">self</span><span class="o">.</span><span class="n">dxl</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dxw</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="bp">self</span><span class="o">.</span><span class="n">dxw</span><span class="p">)</span>        
+        <span class="n">obj</span><span class="o">.</span><span class="n">disp_box</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="bp">self</span><span class="o">.</span><span class="n">disp_box</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">qmin</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="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">qmax</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="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">multi_factor</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">magnetic_on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">npts</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="bp">self</span><span class="o">.</span><span class="n">npts</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">cb1</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="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">smearer</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="bp">self</span><span class="o">.</span><span class="n">smearer</span><span class="p">)</span>
+        
+        <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">state</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">saved_states</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">copy_name</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">name</span><span class="p">)</span>
+            <span class="n">copy_state</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+            <span class="n">obj</span><span class="o">.</span><span class="n">saved_states</span><span class="p">[</span><span class="n">copy_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">copy_state</span>
+        <span class="k">return</span> <span class="n">obj</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_repr_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">list</span><span class="p">,</span> <span class="n">rep</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Helper method to print a state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">:</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;parameter name: </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;value: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;selected: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;error displayed : </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;error value:</span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;minimum displayed : </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</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="n">rep</span> <span class="o">+=</span> <span class="s">&quot;minimum value : </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;maximum displayed : </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;maximum value : </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;parameter unit: </span><span class="si">%s</span><span class="se">\n\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">7</span><span class="p">])</span>
+        <span class="k">return</span> <span class="n">rep</span>
+    
+    <span class="k">def</span> <span class="nf">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        output string for printing</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">rep</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">State name: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">file</span>
+        <span class="n">t</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span><span class="p">)</span>
+        <span class="n">time_str</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&quot;%b </span><span class="si">%d</span><span class="s"> %Y %H;%M;%S &quot;</span><span class="p">,</span> <span class="n">t</span><span class="p">)</span>
+
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;State created: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">time_str</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;State form factor combobox selection: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">formfactorcombobox</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;State structure factor combobox selection: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">structurecombobox</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;is data : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_data</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;data&#39;s name : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_name</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;data&#39;s id : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_id</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">m_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span>
+            <span class="k">if</span> <span class="n">m_name</span> <span class="o">==</span> <span class="s">&#39;Model&#39;</span><span class="p">:</span>
+                <span class="n">m_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">m_name</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;model name : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">m_name</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;model name : None</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="c">#rep += &quot;model type (form factor) selected: %s\n&quot; % self.shape_rbutton </span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;multi_factor : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">multi_factor</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;magnetic_on : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">magnetic_on</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;model type (Category) selected: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">categorycombobox</span>
+        <span class="c">#rep += &quot;model type (shape independent) selected: %s\n&quot; % self.shape_indep_rbutton</span>
+        <span class="c">#rep += &quot;model type (structure factor) selected: %s\n&quot; % self.struct_rbutton</span>
+        <span class="c">#rep += &quot;model type (plug-in ) selected: %s\n&quot; % self.plugin_rbutton</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;data : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Plotting Range: min: </span><span class="si">%s</span><span class="s">, max: </span><span class="si">%s</span><span class="s">, steps: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">),</span>
+                                                <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">),</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts</span><span class="p">))</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Dispersion selection : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disp_box</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Smearing enable : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">enable_smearer</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Smearing disable : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disable_smearer</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Pinhole smearer enable : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pinhole_smearer</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Slit smearer enable : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Dispersity enable : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">enable_disp</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Dispersity disable : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disable_disp</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Slit smearer enable: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">slit_smearer</span><span class="p">)</span>
+        
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;dI_noweight : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_noweight</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;dI_didata : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_didata</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;dI_sqrdata : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_sqrdata</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;dI_idata : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dI_idata</span><span class="p">)</span>
+        
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;2D enable : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">enable2D</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;All parameters checkbox selected: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Value of Chisqr : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tcChi</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Smear object : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smearer</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;Smear type : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">smear_type</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;dq_l  : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">dq_l</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;dq_r  : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">dq_r</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;dx_max  : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dx_max</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;dx_min : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dx_min</span><span class="p">)</span>  
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;dxl  : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dxl</span><span class="p">)</span>
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;dxw : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dxw</span><span class="p">)</span>    
+        <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;model  : </span><span class="si">%s</span><span class="se">\n\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
+        <span class="n">temp_parameters</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">temp_fittable_param</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_2D</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_2D</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_2D</span><span class="p">:</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                        <span class="n">temp_parameters</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params_disp</span><span class="p">:</span>
+                        <span class="n">temp_fittable_param</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">temp_parameters</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span>
+                <span class="n">temp_fittable_param</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fittable_param</span>
+                
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;number parameters(self.parameters): </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">temp_parameters</span><span class="p">)</span>
+            <span class="n">rep</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_repr_helper</span><span class="p">(</span><span class="nb">list</span><span class="o">=</span><span class="n">temp_parameters</span><span class="p">,</span> <span class="n">rep</span><span class="o">=</span><span class="n">rep</span><span class="p">)</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;number str_parameters(self.str_parameters): </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">)</span>
+            <span class="n">rep</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_repr_helper</span><span class="p">(</span><span class="nb">list</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">str_parameters</span><span class="p">,</span> <span class="n">rep</span><span class="o">=</span><span class="n">rep</span><span class="p">)</span>
+            <span class="n">rep</span> <span class="o">+=</span> <span class="s">&quot;number fittable_param(self.fittable_param): </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">temp_fittable_param</span><span class="p">)</span>
+            <span class="n">rep</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_repr_helper</span><span class="p">(</span><span class="nb">list</span><span class="o">=</span><span class="n">temp_fittable_param</span><span class="p">,</span> <span class="n">rep</span><span class="o">=</span><span class="n">rep</span><span class="p">)</span>
+            <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            if is_2D:</span>
+<span class="sd">                rep += &quot;number orientation parameters&quot;</span>
+<span class="sd">                rep += &quot;(self.orientation_params): %s\n&quot;%len(self.orientation_params)</span>
+<span class="sd">                rep = self._repr_helper( list=self.orientation_params, rep=rep)</span>
+<span class="sd">                rep += &quot;number dispersity parameters&quot;</span>
+<span class="sd">                rep += &quot;(self.orientation_params_disp): %s\n&quot;%len(self.orientation_params_disp)</span>
+<span class="sd">                rep = self._repr_helper( list=self.orientation_params_disp, rep=rep)</span>
+<span class="sd">            &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="n">rep</span>
+
+<div class="viewcode-block" id="PageState.set_report_string"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.PageState.set_report_string">[docs]</a>    <span class="k">def</span> <span class="nf">set_report_string</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the values (strings) from __str__ for report</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Dictionary of teh report strings</span>
+        <span class="n">repo_time</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">model_name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">title_name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">file_name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">param_string</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">paramval_string</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">chi2_string</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">multi_factor_string</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">q_range</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">strings</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__repr__</span><span class="p">()</span>
+        <span class="n">lines</span> <span class="o">=</span> <span class="n">strings</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
+
+        <span class="c"># get all string values from __str__()</span>
+        <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+            <span class="n">content</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;:&quot;</span><span class="p">)</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">content</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="n">content</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+            <span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;State created&quot;</span><span class="p">):</span>
+                <span class="n">repo_time</span> <span class="o">=</span> <span class="s">&quot;&quot;</span> <span class="o">+</span> <span class="n">value</span>
+            <span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;parameter name&quot;</span><span class="p">):</span>
+                <span class="n">val_name</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;.&quot;</span><span class="p">)</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">val_name</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">val_name</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;width&quot;</span><span class="p">):</span>
+                        <span class="n">param_string</span> <span class="o">+=</span> <span class="n">value</span> <span class="o">+</span> <span class="s">&#39;,&#39;</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="k">continue</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">param_string</span> <span class="o">+=</span> <span class="n">value</span> <span class="o">+</span> <span class="s">&#39;,&#39;</span>
+            <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;value&quot;</span><span class="p">:</span>
+                <span class="n">param_string</span> <span class="o">+=</span> <span class="n">value</span> <span class="o">+</span> <span class="s">&#39;,&#39;</span>
+            <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;error value&quot;</span><span class="p">:</span>
+                <span class="n">param_string</span> <span class="o">+=</span> <span class="n">value</span> <span class="o">+</span> <span class="s">&#39;,&#39;</span>
+            <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;parameter unit&quot;</span><span class="p">:</span>
+                <span class="n">param_string</span> <span class="o">+=</span> <span class="n">value</span> <span class="o">+</span> <span class="s">&#39;:&#39;</span>
+            <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;Value of Chisqr &quot;</span><span class="p">:</span>
+                <span class="n">chi2</span> <span class="o">=</span> <span class="p">(</span><span class="s">&quot;Chi2/Npts = &quot;</span> <span class="o">+</span> <span class="n">value</span><span class="p">)</span>
+                <span class="n">chi2_string</span> <span class="o">=</span> <span class="n">CENTRE</span> <span class="o">%</span> <span class="n">chi2</span>
+            <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;multi_factor &quot;</span><span class="p">:</span>
+                <span class="n">muti_factor</span> <span class="o">=</span> <span class="p">(</span><span class="s">&quot;muti_factor = &quot;</span> <span class="o">+</span> <span class="n">value</span><span class="p">)</span>
+                <span class="n">muti_factor_string</span> <span class="o">=</span> <span class="n">CENTRE</span> <span class="o">%</span> <span class="n">muti_factor</span>
+            <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;magentic_on &quot;</span><span class="p">:</span>
+                <span class="n">magentic_on</span> <span class="o">=</span> <span class="p">(</span><span class="s">&quot;magentic_on = &quot;</span> <span class="o">+</span> <span class="n">value</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">string</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="o">==</span> <span class="s">&#39;True&#39;</span><span class="p">:</span>
+                    <span class="n">magentic_on_string</span> <span class="o">=</span> <span class="n">CENTRE</span> <span class="o">%</span> <span class="n">magentic_on</span>
+            <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;Title&quot;</span><span class="p">:</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="k">continue</span>
+                <span class="n">title</span> <span class="o">=</span> <span class="n">value</span> <span class="o">+</span> <span class="s">&quot; [&quot;</span> <span class="o">+</span> <span class="n">repo_time</span> <span class="o">+</span> <span class="s">&quot;]&quot;</span>
+                <span class="n">title_name</span> <span class="o">=</span> <span class="n">HEADER</span> <span class="o">%</span> <span class="n">title</span>
+            <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;data &quot;</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="nb">file</span> <span class="o">=</span> <span class="p">(</span><span class="s">&quot;File name:&quot;</span> <span class="o">+</span> <span class="n">content</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
+                    <span class="n">file_name</span> <span class="o">=</span> <span class="n">CENTRE</span> <span class="o">%</span> <span class="nb">file</span>
+                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">title</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">title</span> <span class="o">=</span> <span class="n">content</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot; [&quot;</span> <span class="o">+</span> <span class="n">repo_time</span> <span class="o">+</span> <span class="s">&quot;]&quot;</span>
+                        <span class="n">title_name</span> <span class="o">=</span> <span class="n">HEADER</span> <span class="o">%</span> <span class="n">title</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>
+            <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;model name &quot;</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">modelname</span> <span class="o">=</span> <span class="s">&quot;Model name:&quot;</span> <span class="o">+</span> <span class="n">content</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">modelname</span> <span class="o">=</span> <span class="s">&quot;Model name:&quot;</span> <span class="o">+</span> <span class="s">&quot; NAN&quot;</span>
+                <span class="n">model_name</span> <span class="o">=</span> <span class="n">CENTRE</span> <span class="o">%</span> <span class="n">modelname</span>
+                 
+            <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;Plotting Range&quot;</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">q_range</span> <span class="o">=</span> <span class="n">content</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot; = &quot;</span> <span class="o">+</span> <span class="n">content</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> \
+                            <span class="o">+</span> <span class="s">&quot; = &quot;</span> <span class="o">+</span> <span class="n">content</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;,&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+                    <span class="n">q_name</span> <span class="o">=</span> <span class="p">(</span><span class="s">&quot;Q Range:    &quot;</span> <span class="o">+</span> <span class="n">q_range</span><span class="p">)</span>
+                    <span class="n">q_range</span> <span class="o">=</span> <span class="n">CENTRE</span> <span class="o">%</span> <span class="n">q_name</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>
+        <span class="n">paramval</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">lines</span> <span class="ow">in</span> <span class="n">param_string</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;:&quot;</span><span class="p">):</span>
+            <span class="n">line</span> <span class="o">=</span> <span class="n">lines</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;,&quot;</span><span class="p">)</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">param</span> <span class="o">=</span> <span class="n">line</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="n">param</span> <span class="o">+=</span> <span class="s">&quot; = &quot;</span> <span class="o">+</span> <span class="n">line</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">line</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">())</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">line</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;None&quot;</span><span class="p">):</span>
+                    <span class="n">param</span> <span class="o">+=</span> <span class="s">&quot; +- &quot;</span> <span class="o">+</span> <span class="n">line</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">line</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">())</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">line</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;None&quot;</span><span class="p">):</span>
+                    <span class="n">param</span> <span class="o">+=</span> <span class="s">&quot; &quot;</span> <span class="o">+</span> <span class="n">line</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">paramval</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="n">param</span><span class="p">):</span>
+                    <span class="n">paramval</span> <span class="o">+=</span> <span class="n">param</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span>
+                    <span class="n">paramval_string</span> <span class="o">+=</span> <span class="n">CENTRE</span> <span class="o">%</span> <span class="n">param</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span>
+        
+        <span class="n">text_string</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\n\n\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">title</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="nb">file</span> <span class="o">+</span> \
+                      <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">q_name</span> <span class="o">+</span> \
+                      <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">chi2</span> <span class="o">+</span> \
+                      <span class="s">&quot;</span><span class="se">\n\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">paramval</span>
+        
+        <span class="n">title_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_html_format</span><span class="p">(</span><span class="n">title_name</span><span class="p">)</span>
+        <span class="n">file_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_html_format</span><span class="p">(</span><span class="n">file_name</span><span class="p">)</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_html_format</span><span class="p">(</span><span class="n">title</span><span class="p">)</span>
+                                  
+        <span class="n">html_string</span> <span class="o">=</span> <span class="n">title_name</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">file_name</span> <span class="o">+</span> \
+                                   <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">model_name</span> <span class="o">+</span> \
+                                   <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">q_range</span> <span class="o">+</span> \
+                                   <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">chi2_string</span> <span class="o">+</span> \
+                                   <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">ELINE</span> <span class="o">+</span> \
+                                   <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">paramval_string</span> <span class="o">+</span> \
+                                   <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">ELINE</span> <span class="o">+</span> \
+                                   <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">FEET_1</span> <span class="o">%</span> <span class="n">title</span> <span class="o">+</span> \
+                                   <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="n">FEET_2</span>
+                                                                      
+        <span class="k">return</span> <span class="n">html_string</span><span class="p">,</span> <span class="n">text_string</span><span class="p">,</span> <span class="n">title</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_check_html_format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check string &#39;%&#39; for html format</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;%&#39;</span><span class="p">):</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&#39;%&#39;</span><span class="p">,</span> <span class="s">&#39;&amp;#37&#39;</span><span class="p">)</span>
+        
+        <span class="k">return</span> <span class="n">name</span>
+    
+<div class="viewcode-block" id="PageState.report"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.PageState.report">[docs]</a>    <span class="k">def</span> <span class="nf">report</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">figs</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">canvases</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Invoke report dialog panel</span>
+<span class="sd">        </span>
+<span class="sd">        : param figs: list of pylab figures [list]</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">sas.perspectives.fitting.report_dialog</span> <span class="kn">import</span> <span class="n">ReportDialog</span>
+        <span class="c"># get the strings for report</span>
+        <span class="n">html_str</span><span class="p">,</span> <span class="n">text_str</span><span class="p">,</span> <span class="n">title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_report_string</span><span class="p">()</span>
+        <span class="c"># Allow 2 figures to append</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">figs</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="n">add_str</span> <span class="o">=</span> <span class="n">FEET_3</span>
+        <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">figs</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+            <span class="n">add_str</span> <span class="o">=</span> <span class="n">ELINE</span>
+            <span class="n">add_str</span> <span class="o">+=</span> <span class="n">FEET_2</span> <span class="o">%</span> <span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span><span class="p">)</span>
+            <span class="n">add_str</span> <span class="o">+=</span> <span class="n">ELINE</span>
+            <span class="n">add_str</span> <span class="o">+=</span> <span class="n">FEET_3</span>
+        <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">figs</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">2</span><span class="p">:</span>
+            <span class="n">add_str</span> <span class="o">=</span> <span class="n">ELINE</span>
+            <span class="n">add_str</span> <span class="o">+=</span> <span class="n">FEET_2</span> <span class="o">%</span> <span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span><span class="p">)</span>
+            <span class="n">add_str</span> <span class="o">+=</span> <span class="n">ELINE</span>
+            <span class="n">add_str</span> <span class="o">+=</span> <span class="n">FEET_2</span> <span class="o">%</span> <span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span><span class="p">)</span>
+            <span class="n">add_str</span> <span class="o">+=</span> <span class="n">ELINE</span>
+            <span class="n">add_str</span> <span class="o">+=</span> <span class="n">FEET_3</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">add_str</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+
+        <span class="c"># final report html strings</span>
+        <span class="n">report_str</span> <span class="o">=</span> <span class="n">html_str</span> <span class="o">%</span> <span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">add_str</span>
+
+        <span class="c"># make plot image</span>
+        <span class="n">images</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_plot_state</span><span class="p">(</span><span class="n">figs</span><span class="p">,</span> <span class="n">canvases</span><span class="p">)</span>
+        <span class="n">report_list</span> <span class="o">=</span> <span class="p">[</span><span class="n">report_str</span><span class="p">,</span> <span class="n">text_str</span><span class="p">,</span> <span class="n">images</span><span class="p">]</span>
+        <span class="n">dialog</span> <span class="o">=</span> <span class="n">ReportDialog</span><span class="p">(</span><span class="n">report_list</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="n">dialog</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_toXML_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">thelist</span><span class="p">,</span> <span class="n">element</span><span class="p">,</span> <span class="n">newdoc</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Helper method to create xml file for saving state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">thelist</span><span class="p">:</span>
+            <span class="n">sub_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&#39;parameter&#39;</span><span class="p">)</span>
+            <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
+            <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;value&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]))</span>
+            <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;selected_to_fit&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
+            <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;error_displayed&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">][</span><span class="mi">0</span><span class="p">]))</span>
+            <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;error_value&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">4</span><span class="p">][</span><span class="mi">1</span><span class="p">]))</span>
+            <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;minimum_displayed&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</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="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;minimum_value&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">5</span><span class="p">][</span><span class="mi">1</span><span class="p">]))</span>
+            <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;maximum_displayed&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">][</span><span class="mi">0</span><span class="p">]))</span>
+            <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;maximum_value&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">6</span><span class="p">][</span><span class="mi">1</span><span class="p">]))</span>
+            <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;unit&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">7</span><span class="p">]))</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">sub_element</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="PageState.toXML"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.PageState.toXML">[docs]</a>    <span class="k">def</span> <span class="nf">toXML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">file</span><span class="o">=</span><span class="s">&quot;fitting_state.fitv&quot;</span><span class="p">,</span> <span class="n">doc</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">entry_node</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Writes the state of the InversionControl panel to file, as XML.</span>
+<span class="sd">        </span>
+<span class="sd">        Compatible with standalone writing, or appending to an</span>
+<span class="sd">        already existing XML document. In that case, the XML document</span>
+<span class="sd">        is required. An optional entry node in the XML document may also be given.</span>
+<span class="sd">        </span>
+<span class="sd">        :param file: file to write to</span>
+<span class="sd">        :param doc: XML document object [optional]</span>
+<span class="sd">        :param entry_node: XML node within the XML document at which we will append the data [optional]</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">xml.dom.minidom</span> <span class="kn">import</span> <span class="n">getDOMImplementation</span>
+
+        <span class="c"># Check whether we have to write a standalone XML file</span>
+        <span class="k">if</span> <span class="n">doc</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">impl</span> <span class="o">=</span> <span class="n">getDOMImplementation</span><span class="p">()</span>
+            <span class="n">doc_type</span> <span class="o">=</span> <span class="n">impl</span><span class="o">.</span><span class="n">createDocumentType</span><span class="p">(</span><span class="n">FITTING_NODE_NAME</span><span class="p">,</span> <span class="s">&quot;1.0&quot;</span><span class="p">,</span> <span class="s">&quot;1.0&quot;</span><span class="p">)</span>
+            <span class="n">newdoc</span> <span class="o">=</span> <span class="n">impl</span><span class="o">.</span><span class="n">createDocument</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="n">FITTING_NODE_NAME</span><span class="p">,</span> <span class="n">doc_type</span><span class="p">)</span>
+            <span class="n">top_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">documentElement</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># We are appending to an existing document</span>
+            <span class="n">newdoc</span> <span class="o">=</span> <span class="n">doc</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">top_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">FITTING_NODE_NAME</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">string</span> <span class="o">=</span> <span class="n">etree</span><span class="o">.</span><span class="n">tostring</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">pretty_print</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+                <span class="n">newdoc</span> <span class="o">=</span> <span class="n">parseString</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
+                <span class="n">top_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">FITTING_NODE_NAME</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">entry_node</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">newdoc</span><span class="o">.</span><span class="n">documentElement</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">top_element</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">entry_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">top_element</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">node_name</span> <span class="o">=</span> <span class="n">entry_node</span><span class="o">.</span><span class="n">tag</span>
+                    <span class="n">node_list</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">getElementsByTagName</span><span class="p">(</span><span class="n">node_name</span><span class="p">)</span>
+                    <span class="n">entry_node</span> <span class="o">=</span> <span class="n">node_list</span><span class="o">.</span><span class="n">item</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+                    <span class="n">entry_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">top_element</span><span class="p">)</span>
+                    
+        <span class="n">attr</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createAttribute</span><span class="p">(</span><span class="s">&quot;version&quot;</span><span class="p">)</span>
+        <span class="n">attr</span><span class="o">.</span><span class="n">nodeValue</span> <span class="o">=</span> <span class="s">&#39;1.0&#39;</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">setAttributeNode</span><span class="p">(</span><span class="n">attr</span><span class="p">)</span>
+        
+        <span class="c"># File name</span>
+        <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;filename&quot;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">file</span><span class="p">)))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="nb">file</span><span class="p">)))</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+        
+        <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;timestamp&quot;</span><span class="p">)</span>
+        <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">ctime</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span><span class="p">)))</span>
+        <span class="n">attr</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createAttribute</span><span class="p">(</span><span class="s">&quot;epoch&quot;</span><span class="p">)</span>
+        <span class="n">attr</span><span class="o">.</span><span class="n">nodeValue</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span><span class="p">)</span>
+        <span class="n">element</span><span class="o">.</span><span class="n">setAttributeNode</span><span class="p">(</span><span class="n">attr</span><span class="p">)</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+        <span class="c"># Inputs</span>
+        <span class="n">inputs</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;Attributes&quot;</span><span class="p">)</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">inputs</span><span class="p">)</span>
+       
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="s">&quot;group_id&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_group_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="s">&quot;is_data&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="s">&quot;id&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span>
+       
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_data_attributes</span><span class="p">:</span>
+            <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="k">exec</span> <span class="s">&quot;element.setAttribute(item[0], str(self.</span><span class="si">%s</span><span class="s">))&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+            <span class="n">inputs</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+        
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_state_attributes</span><span class="p">:</span>
+            <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="k">exec</span> <span class="s">&quot;element.setAttribute(item[0], str(self.</span><span class="si">%s</span><span class="s">))&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+            <span class="n">inputs</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+            
+        <span class="c"># For self.values ={ disp_param_name: [vals,...],...}</span>
+        <span class="c"># and for self.weights ={ disp_param_name: [weights,...],...}</span>
+        <span class="nb">list</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_model_attributes</span><span class="p">:</span>
+            <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="k">exec</span> <span class="s">&quot;list = self.</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="nb">list</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="n">sub_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
+                <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">key</span><span class="p">))</span>
+                <span class="k">for</span> <span class="n">val</span> <span class="ow">in</span> <span class="n">value</span><span class="p">:</span>
+                    <span class="n">com</span> <span class="o">=</span> <span class="s">&quot;sub_element.appendChild&quot;</span>
+                    <span class="n">com</span> <span class="o">+=</span> <span class="s">&quot;(newdoc.createTextNode(str(</span><span class="si">%s</span><span class="s">)))&quot;</span>
+                    <span class="k">exec</span> <span class="n">com</span> <span class="o">%</span> <span class="n">val</span>
+                   
+                <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">sub_element</span><span class="p">)</span>
+            <span class="n">inputs</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+        
+        <span class="c"># Create doc for the dictionary of self._disp_obj_dic</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_obj_dic</span><span class="p">:</span>
+            <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="k">exec</span> <span class="s">&quot;list = self.</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">val</span> <span class="ow">in</span> <span class="nb">list</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="nb">repr</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+                <span class="n">sub_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
+                <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">key</span><span class="p">))</span>
+                <span class="n">sub_element</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&#39;value&#39;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">value</span><span class="p">))</span>
+                <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">sub_element</span><span class="p">)</span>
+            <span class="n">inputs</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+                 
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_state_parameters</span><span class="p">:</span>
+            <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="n">com</span> <span class="o">=</span> <span class="s">&quot;self._toXML_helper(thelist=self.</span><span class="si">%s</span><span class="s">,&quot;</span>
+            <span class="n">com</span> <span class="o">+=</span> <span class="s">&quot; element=element, newdoc=newdoc)&quot;</span>
+            <span class="k">exec</span> <span class="n">com</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            <span class="n">inputs</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+        
+        <span class="c"># Save the file</span>
+        <span class="k">if</span> <span class="n">doc</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">fd</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="nb">file</span><span class="p">,</span> <span class="s">&#39;w&#39;</span><span class="p">)</span>
+            <span class="n">fd</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">toprettyxml</span><span class="p">())</span>
+            <span class="n">fd</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">newdoc</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_fromXML_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">node</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Helper function to write state to xml</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">node</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;value&#39;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">selected_to_fit</span> <span class="o">=</span> <span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;selected_to_fit&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="s">&quot;True&quot;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">selected_to_fit</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">error_displayed</span> <span class="o">=</span> <span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;error_displayed&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="s">&quot;True&quot;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">error_displayed</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">error_value</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;error_value&#39;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">error_value</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">minimum_displayed</span> <span class="o">=</span> <span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;minimum_displayed&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="s">&quot;True&quot;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">minimum_displayed</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">minimum_value</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;minimum_value&#39;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">minimum_value</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">maximum_displayed</span> <span class="o">=</span> <span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;maximum_displayed&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="s">&quot;True&quot;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">maximum_displayed</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">maximum_value</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;maximum_value&#39;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">maximum_value</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">unit</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;unit&#39;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">unit</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="nb">list</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">selected_to_fit</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="s">&quot;+/-&quot;</span><span class="p">,</span>
+                         <span class="p">[</span><span class="n">error_displayed</span><span class="p">,</span> <span class="n">error_value</span><span class="p">],</span>
+                         <span class="p">[</span><span class="n">minimum_displayed</span><span class="p">,</span> <span class="n">minimum_value</span><span class="p">],</span>
+                         <span class="p">[</span><span class="n">maximum_displayed</span><span class="p">,</span> <span class="n">maximum_value</span><span class="p">],</span> <span class="n">unit</span><span class="p">])</span>
+       
+<div class="viewcode-block" id="PageState.fromXML"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.PageState.fromXML">[docs]</a>    <span class="k">def</span> <span class="nf">fromXML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">file</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">node</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Load fitting state from a file</span>
+<span class="sd">        </span>
+<span class="sd">        :param file: .fitv file</span>
+<span class="sd">        :param node: node of a XML document to read from</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">file</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;PageState no longer supports non-CanSAS&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; format for fitting files&quot;</span>
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">msg</span>
+            
+        <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;version&#39;</span><span class="p">)</span><span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;version&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="s">&#39;1.0&#39;</span><span class="p">:</span>
+            
+            <span class="c"># Get file name</span>
+            <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:filename&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="n">entry</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                
+            <span class="c"># Get time stamp</span>
+            <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:timestamp&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">entry</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;epoch&#39;</span><span class="p">):</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">entry</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;epoch&#39;</span><span class="p">))</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;PageState.fromXML: Could not&quot;</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; read timestamp</span><span class="se">\n</span><span class="s"> </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                    <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+            
+            <span class="c"># Parse fitting attributes</span>
+            <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:Attributes&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_data_attributes</span><span class="p">:</span>
+                <span class="n">node</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">entry</span><span class="p">)</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="k">exec</span> <span class="s">&quot;self.</span><span class="si">%s</span><span class="s"> = parse_entry_helper(node, item)&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                    
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">raise</span>
+
+            <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_state_attributes</span><span class="p">:</span>
+                    <span class="n">node</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">entry</span><span class="p">)</span>
+                    <span class="k">try</span><span class="p">:</span>
+                        <span class="k">exec</span> <span class="s">&quot;self.</span><span class="si">%s</span><span class="s"> = parse_entry_helper(node, item)&quot;</span> <span class="o">%</span> \
+                                                                <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+                    <span class="k">except</span><span class="p">:</span>
+                        <span class="k">raise</span>
+                    
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_state_parameters</span><span class="p">:</span>
+                    <span class="n">node</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&quot;ns:</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">entry</span><span class="p">)</span>
+                    <span class="k">exec</span> <span class="s">&quot;self._fromXML_helper(node=node, list=self.</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> \
+                                                                    <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                
+                <span class="c"># Recover _disp_obj_dict from xml file</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_disp_obj_dict</span> <span class="o">=</span> <span class="p">{}</span>
+                <span class="n">disp_model</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_obj_dic</span><span class="p">:</span>
+                    <span class="c"># Get node</span>
+                    <span class="n">node</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&quot;ns:</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">entry</span><span class="p">)</span>
+                    <span class="k">for</span> <span class="n">attr</span> <span class="ow">in</span> <span class="n">node</span><span class="p">:</span>
+                        <span class="n">name</span> <span class="o">=</span> <span class="n">attr</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span>
+                        <span class="n">val</span> <span class="o">=</span> <span class="n">attr</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;value&#39;</span><span class="p">)</span>
+                        <span class="n">value</span> <span class="o">=</span> <span class="n">val</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot; instance&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+                        <span class="n">disp_name</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;&lt;&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="c"># Try to recover disp_model object from strings</span>
+                            <span class="n">com</span> <span class="o">=</span> <span class="s">&quot;from sas.models.dispersion_models &quot;</span>
+                            <span class="n">com</span> <span class="o">+=</span> <span class="s">&quot;import </span><span class="si">%s</span><span class="s"> as disp&quot;</span>
+                            <span class="n">com_name</span> <span class="o">=</span> <span class="n">disp_name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;.&quot;</span><span class="p">)[</span><span class="mi">3</span><span class="p">]</span>
+                            <span class="k">exec</span> <span class="n">com</span> <span class="o">%</span> <span class="n">com_name</span>
+                            <span class="n">disp_model</span> <span class="o">=</span> <span class="n">disp</span><span class="p">()</span>
+                            <span class="k">exec</span> <span class="s">&quot;self.</span><span class="si">%s</span><span class="s">[&#39;</span><span class="si">%s</span><span class="s">&#39;] = com_name&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">name</span><span class="p">)</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="k">pass</span>
+                        
+                <span class="c"># get self.values and self.weights dic. if exists</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_model_attributes</span><span class="p">:</span>
+                    <span class="n">node</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&quot;ns:</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">entry</span><span class="p">)</span>
+                    <span class="n">dic</span> <span class="o">=</span> <span class="p">{}</span>
+                    <span class="nb">list</span> <span class="o">=</span> <span class="p">[]</span>
+                    <span class="k">for</span> <span class="n">par</span> <span class="ow">in</span> <span class="n">node</span><span class="p">:</span>
+                        <span class="n">name</span> <span class="o">=</span> <span class="n">par</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span>
+                        <span class="n">values</span> <span class="o">=</span> <span class="n">par</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
+                        <span class="c"># Get lines only with numbers</span>
+                        <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">values</span><span class="p">:</span>
+                            <span class="k">try</span><span class="p">:</span>
+                                <span class="n">val</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
+                                <span class="nb">list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+                            <span class="k">except</span><span class="p">:</span>
+                                <span class="c"># pass if line is empty (it happens)</span>
+                                <span class="k">pass</span>
+                    <span class="n">dic</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span>
+                    <span class="k">exec</span> <span class="s">&quot;self.</span><span class="si">%s</span><span class="s"> = dic&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                    </div>
+<div class="viewcode-block" id="PageState.set_plot_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.PageState.set_plot_state">[docs]</a>    <span class="k">def</span> <span class="nf">set_plot_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">figs</span><span class="p">,</span> <span class="n">canvases</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Build image state that wx.html understand</span>
+<span class="sd">        by plotting, putting it into wx.FileSystem image object</span>
+
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">images</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c"># some imports</span>
+        <span class="kn">import</span> <span class="nn">wx</span>
+
+        <span class="c"># Reset memory</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">imgRAM</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">MemoryFSHandler</span><span class="p">()</span>
+        
+        <span class="c"># For no figures in the list, prepare empty plot</span>
+        <span class="k">if</span> <span class="n">figs</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">figs</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">figs</span> <span class="o">=</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span>
+            
+        <span class="c"># Loop over the list of figures</span>
+        <span class="c"># use wx.MemoryFSHandler</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">imgRAM</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MemoryFSHandler</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">fig</span> <span class="ow">in</span> <span class="n">figs</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">figs</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">ind</span> <span class="o">=</span> <span class="n">figs</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">fig</span><span class="p">)</span>
+                <span class="n">canvas</span> <span class="o">=</span> <span class="n">canvases</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span>
+                
+            <span class="c">#store the image in wx.FileSystem Object </span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">FileSystem</span><span class="o">.</span><span class="n">AddHandler</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">MemoryFSHandler</span><span class="p">())</span>
+            
+            <span class="c"># index of the fig</span>
+            <span class="n">ind</span> <span class="o">=</span> <span class="n">figs</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">fig</span><span class="p">)</span>
+            
+            <span class="c">#AddFile, image can be retrieved with &#39;memory:filename&#39;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">imgRAM</span><span class="o">.</span><span class="n">AddFile</span><span class="p">(</span><span class="s">&#39;img_fit</span><span class="si">%s</span><span class="s">.png&#39;</span> <span class="o">%</span> <span class="n">ind</span><span class="p">,</span>
+                                <span class="n">canvas</span><span class="o">.</span><span class="n">bitmap</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">BITMAP_TYPE_PNG</span><span class="p">)</span>
+            
+            <span class="c">#append figs</span>
+            <span class="n">images</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">fig</span><span class="p">)</span>
+            
+        <span class="k">return</span> <span class="n">images</span>
+
+</div></div>
+<div class="viewcode-block" id="Reader"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.Reader">[docs]</a><span class="k">class</span> <span class="nc">Reader</span><span class="p">(</span><span class="n">CansasReader</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Class to load a .fitv fitting file</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## File type</span>
+    <span class="n">type_name</span> <span class="o">=</span> <span class="s">&quot;Fitting&quot;</span>
+    
+    <span class="c">## Wildcards</span>
+    <span class="nb">type</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;Fitting files (*.fitv)|*.fitv&quot;</span>
+            <span class="s">&quot;SASView file (*.svs)|*.svs&quot;</span><span class="p">]</span>
+    <span class="c">## List of allowed extensions</span>
+    <span class="n">ext</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;.fitv&#39;</span><span class="p">,</span> <span class="s">&#39;.FITV&#39;</span><span class="p">,</span> <span class="s">&#39;.svs&#39;</span><span class="p">,</span> <span class="s">&#39;SVS&#39;</span><span class="p">]</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">call_back</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">cansas</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+        <span class="n">CansasReader</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialize the call-back method to be called</span>
+<span class="sd">        after we load a file</span>
+<span class="sd">        </span>
+<span class="sd">        :param call_back: call-back method</span>
+<span class="sd">        :param cansas:  True = files will be written/read in CanSAS format</span>
+<span class="sd">                        False = write CanSAS format</span>
+<span class="sd">            </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Call back method to be executed after a file is read</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">call_back</span> <span class="o">=</span> <span class="n">call_back</span>
+        <span class="c">## CanSAS format flag</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cansas</span> <span class="o">=</span> <span class="n">cansas</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>
+        
+<div class="viewcode-block" id="Reader.get_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.Reader.get_state">[docs]</a>    <span class="k">def</span> <span class="nf">get_state</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span>
+        </div>
+<div class="viewcode-block" id="Reader.read"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.Reader.read">[docs]</a>    <span class="k">def</span> <span class="nf">read</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Load a new P(r) inversion state from file</span>
+<span class="sd">        </span>
+<span class="sd">        :param path: file path</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cansas</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_read_cansas</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+     </div>
+    <span class="k">def</span> <span class="nf">_data2d_to_xml_doc</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">datainfo</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create an XML document to contain the content of a Data2D</span>
+<span class="sd">        </span>
+<span class="sd">        :param datainfo: Data2D object</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data2D</span><span class="p">):</span>
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="s">&quot;The cansas writer expects a Data2D instance&quot;</span>
+        
+        <span class="n">doc</span> <span class="o">=</span> <span class="n">xml</span><span class="o">.</span><span class="n">dom</span><span class="o">.</span><span class="n">minidom</span><span class="o">.</span><span class="n">Document</span><span class="p">()</span>
+        <span class="n">main_node</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;SASroot&quot;</span><span class="p">)</span>
+        <span class="n">main_node</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&quot;version&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">version</span><span class="p">)</span>
+        <span class="n">main_node</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&quot;xmlns&quot;</span><span class="p">,</span> <span class="s">&quot;cansas1d/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">version</span><span class="p">)</span>
+        <span class="n">main_node</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&quot;xmlns:xsi&quot;</span><span class="p">,</span> <span class="s">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span><span class="p">)</span>
+        <span class="n">main_node</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&quot;xsi:schemaLocation&quot;</span><span class="p">,</span> <span class="s">&quot;cansas1d/</span><span class="si">%s</span><span class="s"> http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">version</span><span class="p">)</span>
+        
+        <span class="n">doc</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">main_node</span><span class="p">)</span>
+        
+        <span class="n">entry_node</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;SASentry&quot;</span><span class="p">)</span>
+        <span class="n">main_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">entry_node</span><span class="p">)</span>
+       
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">entry_node</span><span class="p">,</span> <span class="s">&quot;Title&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">title</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">datainfo</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">entry_node</span><span class="p">,</span> <span class="s">&quot;data_class&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">run</span><span class="p">:</span>
+            <span class="n">runname</span> <span class="o">=</span> <span class="p">{}</span>
+            <span class="k">if</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">run_name</span><span class="o">.</span><span class="n">has_key</span><span class="p">(</span><span class="n">item</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">run_name</span><span class="p">[</span><span class="n">item</span><span class="p">]))</span><span class="o">&gt;</span><span class="mi">1</span><span class="p">:</span>
+                <span class="n">runname</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;name&#39;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">run_name</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="p">}</span>
+            <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">entry_node</span><span class="p">,</span> <span class="s">&quot;Run&quot;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">runname</span><span class="p">)</span>
+        <span class="c"># Data info</span>
+        <span class="n">new_node</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;SASdata&quot;</span><span class="p">)</span>
+        <span class="n">entry_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">new_node</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_data_2d_attr</span><span class="p">:</span>
+            <span class="n">element</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="k">exec</span> <span class="s">&quot;element.setAttribute(item[0], str(datainfo.</span><span class="si">%s</span><span class="s">))&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+            <span class="n">new_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+            
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_data2d_values</span><span class="p">:</span>
+            <span class="n">root_node</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="n">new_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">root_node</span><span class="p">)</span>
+            <span class="n">temp_list</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">exec</span> <span class="s">&quot;temp_list = datainfo.</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+
+            <span class="k">if</span> <span class="n">temp_list</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">temp_list</span><span class="p">)</span><span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">element</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+                <span class="k">exec</span> <span class="s">&quot;element.appendChild(doc.createTextNode(str(</span><span class="si">%s</span><span class="s">)))&quot;</span> <span class="o">%</span> <span class="n">temp_list</span>
+                <span class="n">root_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">temp_list</span><span class="p">:</span>
+                    <span class="n">element</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+                    <span class="k">exec</span> <span class="s">&quot;element.setAttribute(item[0], str(</span><span class="si">%s</span><span class="s">))&quot;</span> <span class="o">%</span> <span class="n">value</span>
+                    <span class="n">root_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+       
+        <span class="c"># Sample info</span>
+        <span class="n">sample</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;SASsample&quot;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">name</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">sample</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+        <span class="n">entry_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">sample</span><span class="p">)</span>
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">sample</span><span class="p">,</span> <span class="s">&quot;ID&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">ID</span><span class="p">))</span>
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">sample</span><span class="p">,</span> <span class="s">&quot;thickness&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">thickness</span><span class="p">,</span>
+                   <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">thickness_unit</span><span class="p">})</span>
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">sample</span><span class="p">,</span> <span class="s">&quot;transmission&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">transmission</span><span class="p">)</span>
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">sample</span><span class="p">,</span> <span class="s">&quot;temperature&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">temperature</span><span class="p">,</span>
+                   <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">temperature_unit</span><span class="p">})</span>
+        
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">details</span><span class="p">:</span>
+            <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">sample</span><span class="p">,</span> <span class="s">&quot;details&quot;</span><span class="p">,</span> <span class="n">item</span><span class="p">)</span>
+        
+        <span class="n">pos</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;position&quot;</span><span class="p">)</span>
+        <span class="n">written</span> <span class="o">=</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">pos</span><span class="p">,</span> <span class="s">&quot;x&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                             <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">position_unit</span><span class="p">})</span>
+        <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">pos</span><span class="p">,</span> <span class="s">&quot;y&quot;</span><span class="p">,</span>
+                                       <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                       <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">position_unit</span><span class="p">})</span>
+        <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">pos</span><span class="p">,</span> <span class="s">&quot;z&quot;</span><span class="p">,</span>
+                                       <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">position</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                       <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">position_unit</span><span class="p">})</span>
+        <span class="k">if</span> <span class="n">written</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="n">sample</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+        
+        <span class="n">ori</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;orientation&quot;</span><span class="p">)</span>
+        <span class="n">written</span> <span class="o">=</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">ori</span><span class="p">,</span> <span class="s">&quot;roll&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                             <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">orientation_unit</span><span class="p">})</span>
+        <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">ori</span><span class="p">,</span> <span class="s">&quot;pitch&quot;</span><span class="p">,</span>
+                                       <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                       <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">orientation_unit</span><span class="p">})</span>
+        <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">ori</span><span class="p">,</span> <span class="s">&quot;yaw&quot;</span><span class="p">,</span>
+                                       <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                       <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">orientation_unit</span><span class="p">})</span>
+        <span class="k">if</span> <span class="n">written</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="n">sample</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">ori</span><span class="p">)</span>
+        
+        <span class="c"># Instrument info</span>
+        <span class="n">instr</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;SASinstrument&quot;</span><span class="p">)</span>
+        <span class="n">entry_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">instr</span><span class="p">)</span>
+        
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">instr</span><span class="p">,</span> <span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">instrument</span><span class="p">)</span>
+        
+        <span class="c">#   Source</span>
+        <span class="n">source</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;SASsource&quot;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">name</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">source</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+        <span class="n">instr</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">source</span><span class="p">)</span>
+        
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="s">&quot;radiation&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">radiation</span><span class="p">)</span>
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="s">&quot;beam_shape&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">beam_shape</span><span class="p">)</span>
+        <span class="n">size</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;beam_size&quot;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">beam_size_name</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">size</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">beam_size_name</span><span class="p">))</span>
+        <span class="n">written</span> <span class="o">=</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="s">&quot;x&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                             <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">beam_size_unit</span><span class="p">})</span>
+        <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="s">&quot;y&quot;</span><span class="p">,</span>
+                                       <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                       <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">beam_size_unit</span><span class="p">})</span>
+        <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="s">&quot;z&quot;</span><span class="p">,</span>
+                                       <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">beam_size</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                       <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">beam_size_unit</span><span class="p">})</span>
+        <span class="k">if</span> <span class="n">written</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="n">source</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">size</span><span class="p">)</span>
+            
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="s">&quot;wavelength&quot;</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength</span><span class="p">,</span>
+                   <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_unit</span><span class="p">})</span>
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="s">&quot;wavelength_min&quot;</span><span class="p">,</span>
+                   <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_min</span><span class="p">,</span>
+                   <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_min_unit</span><span class="p">})</span>
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="s">&quot;wavelength_max&quot;</span><span class="p">,</span>
+                   <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_max</span><span class="p">,</span>
+                   <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_max_unit</span><span class="p">})</span>
+        <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="s">&quot;wavelength_spread&quot;</span><span class="p">,</span>
+                   <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_spread</span><span class="p">,</span>
+                   <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">wavelength_spread_unit</span><span class="p">})</span>
+        
+        <span class="c">#   Collimation</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">collimation</span><span class="p">:</span>
+            <span class="n">coll</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;SAScollimation&quot;</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">name</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">coll</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+            <span class="n">instr</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">coll</span><span class="p">)</span>
+            
+            <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">coll</span><span class="p">,</span> <span class="s">&quot;length&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">length</span><span class="p">,</span>
+                       <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">length_unit</span><span class="p">})</span>
+            
+            <span class="k">for</span> <span class="n">apert</span> <span class="ow">in</span> <span class="n">item</span><span class="o">.</span><span class="n">aperture</span><span class="p">:</span>
+                <span class="n">ap</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;aperture&quot;</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">apert</span><span class="o">.</span><span class="n">name</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">ap</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">apert</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+                <span class="k">if</span> <span class="n">apert</span><span class="o">.</span><span class="n">type</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">ap</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&quot;type&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">apert</span><span class="o">.</span><span class="n">type</span><span class="p">))</span>
+                <span class="n">coll</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">ap</span><span class="p">)</span>
+                
+                <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">ap</span><span class="p">,</span> <span class="s">&quot;distance&quot;</span><span class="p">,</span> <span class="n">apert</span><span class="o">.</span><span class="n">distance</span><span class="p">,</span>
+                           <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">apert</span><span class="o">.</span><span class="n">distance_unit</span><span class="p">})</span>
+                
+                <span class="n">size</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;size&quot;</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">apert</span><span class="o">.</span><span class="n">size_name</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">size</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">apert</span><span class="o">.</span><span class="n">size_name</span><span class="p">))</span>
+                <span class="n">written</span> <span class="o">=</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="s">&quot;x&quot;</span><span class="p">,</span> <span class="n">apert</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                     <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">apert</span><span class="o">.</span><span class="n">size_unit</span><span class="p">})</span>
+                <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="s">&quot;y&quot;</span><span class="p">,</span> <span class="n">apert</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                               <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">apert</span><span class="o">.</span><span class="n">size_unit</span><span class="p">})</span>
+                <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="s">&quot;z&quot;</span><span class="p">,</span> <span class="n">apert</span><span class="o">.</span><span class="n">size</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                               <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">apert</span><span class="o">.</span><span class="n">size_unit</span><span class="p">})</span>
+                <span class="k">if</span> <span class="n">written</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+                    <span class="n">ap</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">size</span><span class="p">)</span>
+
+        <span class="c">#   Detectors</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">detector</span><span class="p">:</span>
+            <span class="n">det</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;SASdetector&quot;</span><span class="p">)</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">det</span><span class="p">,</span> <span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">det</span><span class="p">,</span> <span class="s">&quot;SDD&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">distance</span><span class="p">,</span>
+                                           <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">distance_unit</span><span class="p">})</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">det</span><span class="p">,</span> <span class="s">&quot;slit_length&quot;</span><span class="p">,</span>
+                                           <span class="n">item</span><span class="o">.</span><span class="n">slit_length</span><span class="p">,</span>
+                                           <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">slit_length_unit</span><span class="p">})</span>
+            <span class="k">if</span> <span class="n">written</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+                <span class="n">instr</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">det</span><span class="p">)</span>
+            
+            <span class="n">off</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;offset&quot;</span><span class="p">)</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">off</span><span class="p">,</span> <span class="s">&quot;x&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                 <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">offset_unit</span><span class="p">})</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">off</span><span class="p">,</span> <span class="s">&quot;y&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                           <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">offset_unit</span><span class="p">})</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">off</span><span class="p">,</span> <span class="s">&quot;z&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">offset</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                           <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">offset_unit</span><span class="p">})</span>
+            <span class="k">if</span> <span class="n">written</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+                <span class="n">det</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">off</span><span class="p">)</span>
+            
+            <span class="n">center</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;beam_center&quot;</span><span class="p">)</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">center</span><span class="p">,</span> <span class="s">&quot;x&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                 <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">beam_center_unit</span><span class="p">})</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">center</span><span class="p">,</span> <span class="s">&quot;y&quot;</span><span class="p">,</span>
+                                           <span class="n">item</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                           <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">beam_center_unit</span><span class="p">})</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">center</span><span class="p">,</span> <span class="s">&quot;z&quot;</span><span class="p">,</span>
+                                           <span class="n">item</span><span class="o">.</span><span class="n">beam_center</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                           <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">beam_center_unit</span><span class="p">})</span>
+            <span class="k">if</span> <span class="n">written</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+                <span class="n">det</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">center</span><span class="p">)</span>
+                
+            <span class="n">pix</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;pixel_size&quot;</span><span class="p">)</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">pix</span><span class="p">,</span> <span class="s">&quot;x&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                 <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">pixel_size_unit</span><span class="p">})</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">pix</span><span class="p">,</span> <span class="s">&quot;y&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                           <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">pixel_size_unit</span><span class="p">})</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">pix</span><span class="p">,</span> <span class="s">&quot;z&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">pixel_size</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                           <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">pixel_size_unit</span><span class="p">})</span>
+            <span class="k">if</span> <span class="n">written</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+                <span class="n">det</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">pix</span><span class="p">)</span>
+                
+            <span class="n">ori</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;orientation&quot;</span><span class="p">)</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">ori</span><span class="p">,</span> <span class="s">&quot;roll&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">x</span><span class="p">,</span>
+                                 <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">orientation_unit</span><span class="p">})</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">ori</span><span class="p">,</span> <span class="s">&quot;pitch&quot;</span><span class="p">,</span>
+                                           <span class="n">item</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">y</span><span class="p">,</span>
+                                           <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">orientation_unit</span><span class="p">})</span>
+            <span class="n">written</span> <span class="o">=</span> <span class="n">written</span> <span class="o">|</span> <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">ori</span><span class="p">,</span> <span class="s">&quot;yaw&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">orientation</span><span class="o">.</span><span class="n">z</span><span class="p">,</span>
+                                           <span class="p">{</span><span class="s">&quot;unit&quot;</span><span class="p">:</span> <span class="n">item</span><span class="o">.</span><span class="n">orientation_unit</span><span class="p">})</span>
+            <span class="k">if</span> <span class="n">written</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+                <span class="n">det</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">ori</span><span class="p">)</span>
+                
+        <span class="c"># Processes info</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">process</span><span class="p">:</span>
+            <span class="n">node</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;SASprocess&quot;</span><span class="p">)</span>
+            <span class="n">entry_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">node</span><span class="p">)</span>
+
+            <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">node</span><span class="p">,</span> <span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+            <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">node</span><span class="p">,</span> <span class="s">&quot;date&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">date</span><span class="p">)</span>
+            <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">node</span><span class="p">,</span> <span class="s">&quot;description&quot;</span><span class="p">,</span> <span class="n">item</span><span class="o">.</span><span class="n">description</span><span class="p">)</span>
+            <span class="k">for</span> <span class="n">term</span> <span class="ow">in</span> <span class="n">item</span><span class="o">.</span><span class="n">term</span><span class="p">:</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="n">term</span><span class="p">[</span><span class="s">&#39;value&#39;</span><span class="p">]</span>
+                <span class="k">del</span> <span class="n">term</span><span class="p">[</span><span class="s">&#39;value&#39;</span><span class="p">]</span>
+                <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">node</span><span class="p">,</span> <span class="s">&quot;term&quot;</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">term</span><span class="p">)</span>
+            <span class="k">for</span> <span class="n">note</span> <span class="ow">in</span> <span class="n">item</span><span class="o">.</span><span class="n">notes</span><span class="p">:</span>
+                <span class="n">write_node</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="n">node</span><span class="p">,</span> <span class="s">&quot;SASprocessnote&quot;</span><span class="p">,</span> <span class="n">note</span><span class="p">)</span>
+        <span class="c"># Return the document, and the SASentry node associated with</span>
+        <span class="c"># the data we just wrote</span>
+        <span class="k">return</span> <span class="n">doc</span><span class="p">,</span> <span class="n">entry_node</span>
+   
+    <span class="k">def</span> <span class="nf">_parse_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">entry</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Read a fit result from an XML node</span>
+<span class="sd">        </span>
+<span class="sd">        :param entry: XML node to read from</span>
+<span class="sd">        </span>
+<span class="sd">        :return: PageState object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Create an empty state</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>   
+        <span class="c"># Locate the P(r) node</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">nodes</span> <span class="o">=</span> <span class="n">entry</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">FITTING_NODE_NAME</span><span class="p">,</span>
+                                <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+            <span class="k">if</span> <span class="n">nodes</span> <span class="o">!=</span> <span class="p">[]:</span>
+                <span class="c"># Create an empty state</span>
+                <span class="n">state</span> <span class="o">=</span> <span class="n">PageState</span><span class="p">()</span>
+                <span class="n">state</span><span class="o">.</span><span class="n">fromXML</span><span class="p">(</span><span class="n">node</span><span class="o">=</span><span class="n">nodes</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+                
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;XML document does not contain fitting information.</span><span class="se">\n</span><span class="s"> </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+            
+        <span class="k">return</span> <span class="n">state</span>
+      
+    <span class="k">def</span> <span class="nf">_parse_save_state_entry</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dom</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Parse a SASentry</span>
+<span class="sd">        </span>
+<span class="sd">        :param node: SASentry node</span>
+<span class="sd">        </span>
+<span class="sd">        :return: Data1D/Data2D object</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">node</span> <span class="o">=</span> <span class="n">dom</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:data_class&#39;</span><span class="p">,</span> <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">node</span> <span class="ow">or</span> <span class="n">node</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;Data2D&quot;</span><span class="p">:</span>
+            <span class="n">return_value</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_entry</span><span class="p">(</span><span class="n">dom</span><span class="p">)</span>
+            <span class="n">numpy</span><span class="o">.</span><span class="n">trim_zeros</span><span class="p">(</span><span class="n">return_value</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+            <span class="n">numpy</span><span class="o">.</span><span class="n">trim_zeros</span><span class="p">(</span><span class="n">return_value</span><span class="o">.</span><span class="n">y</span><span class="p">)</span>
+            <span class="n">numpy</span><span class="o">.</span><span class="n">trim_zeros</span><span class="p">(</span><span class="n">return_value</span><span class="o">.</span><span class="n">dy</span><span class="p">)</span>
+            <span class="n">size_dx</span> <span class="o">=</span> <span class="n">return_value</span><span class="o">.</span><span class="n">dx</span><span class="o">.</span><span class="n">size</span>
+            <span class="n">size_dxl</span> <span class="o">=</span> <span class="n">return_value</span><span class="o">.</span><span class="n">dxl</span><span class="o">.</span><span class="n">size</span>
+            <span class="n">size_dxw</span> <span class="o">=</span> <span class="n">return_value</span><span class="o">.</span><span class="n">dxw</span><span class="o">.</span><span class="n">size</span>
+            <span class="k">if</span> <span class="n">size_dxl</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">size_dxw</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">return_value</span><span class="o">.</span><span class="n">dxl</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">return_value</span><span class="o">.</span><span class="n">dxw</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">numpy</span><span class="o">.</span><span class="n">trim_zeros</span><span class="p">(</span><span class="n">return_value</span><span class="o">.</span><span class="n">dx</span><span class="p">)</span>
+            <span class="k">elif</span> <span class="n">size_dx</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">return_value</span><span class="o">.</span><span class="n">dx</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">size_dx</span> <span class="o">=</span> <span class="n">size_dxl</span>
+                <span class="n">numpy</span><span class="o">.</span><span class="n">trim_zeros</span><span class="p">(</span><span class="n">return_value</span><span class="o">.</span><span class="n">dxl</span><span class="p">)</span>
+                <span class="n">numpy</span><span class="o">.</span><span class="n">trim_zeros</span><span class="p">(</span><span class="n">return_value</span><span class="o">.</span><span class="n">dxw</span><span class="p">)</span>
+                            
+            <span class="k">return</span> <span class="n">return_value</span><span class="p">,</span> <span class="n">_</span>
+        
+        <span class="c">#Parse 2D</span>
+        <span class="n">data_info</span> <span class="o">=</span> <span class="n">Data2D</span><span class="p">()</span>
+        
+        <span class="c"># Look up title</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_content</span><span class="p">(</span><span class="s">&#39;ns:Title&#39;</span><span class="p">,</span> <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;title&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="p">)</span>
+        
+        <span class="c"># Look up run number</span>
+        <span class="n">nodes</span> <span class="o">=</span> <span class="n">dom</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:Run&#39;</span><span class="p">,</span> <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">nodes</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">text</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="n">data_info</span><span class="o">.</span><span class="n">run</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="n">data_info</span><span class="o">.</span><span class="n">run_name</span><span class="p">[</span><span class="n">value</span><span class="p">]</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span>
+                           
+        <span class="c"># Look up instrument name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_content</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:name&#39;</span><span class="p">,</span> <span class="n">dom</span><span class="p">,</span>
+                            <span class="s">&#39;instrument&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="p">)</span>
+
+        <span class="c"># Notes</span>
+        <span class="n">note_list</span> <span class="o">=</span> <span class="n">dom</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:SASnote&#39;</span><span class="p">,</span> <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+        <span class="k">for</span> <span class="n">note</span> <span class="ow">in</span> <span class="n">note_list</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">note</span><span class="o">.</span><span class="n">text</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">note_value</span> <span class="o">=</span> <span class="n">note</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">note_value</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">data_info</span><span class="o">.</span><span class="n">notes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">note_value</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">err_mess</span> <span class="o">=</span> <span class="s">&quot;cansas_reader.read: error processing entry notes</span><span class="se">\n</span><span class="s">  </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">err_mess</span><span class="p">)</span>
+                <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">err_mess</span><span class="p">)</span>
+        
+        <span class="c"># Sample info ###################</span>
+        <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:SASsample&#39;</span><span class="p">,</span> <span class="n">dom</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">entry</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_content</span><span class="p">(</span><span class="s">&#39;ns:SASsample/ns:ID&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;ID&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASsample/ns:thickness&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;thickness&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASsample/ns:transmission&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;transmission&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASsample/ns:temperature&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;temperature&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="p">)</span>
+        
+        <span class="n">nodes</span> <span class="o">=</span> <span class="n">dom</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:SASsample/ns:details&#39;</span><span class="p">,</span>
+                          <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">nodes</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">text</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">detail_value</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">detail_value</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="o">.</span><span class="n">details</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">detail_value</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">err_mess</span> <span class="o">=</span> <span class="s">&quot;cansas_reader.read: error processing sample details</span><span class="se">\n</span><span class="s">  </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">err_mess</span><span class="p">)</span>
+                <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">err_mess</span><span class="p">)</span>
+        
+        <span class="c"># Position (as a vector)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASsample/ns:position/ns:x&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;position.x&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASsample/ns:position/ns:y&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;position.y&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASsample/ns:position/ns:z&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;position.z&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="p">)</span>
+        
+        <span class="c"># Orientation (as a vector)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASsample/ns:orientation/ns:roll&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;orientation.x&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASsample/ns:orientation/ns:pitch&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;orientation.y&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASsample/ns:orientation/ns:yaw&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;orientation.z&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">sample</span><span class="p">)</span>
+       
+        <span class="c"># Source info ###################</span>
+        <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASsource&#39;</span><span class="p">,</span> <span class="n">dom</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data_info</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">entry</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_content</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASsource/ns:radiation&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;radiation&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_content</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASsource/ns:beam_shape&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;beam_shape&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASsource/ns:wavelength&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;wavelength&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASsource/ns:wavelength_min&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;wavelength_min&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASsource/ns:wavelength_max&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;wavelength_max&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASsource/ns:wavelength_spread&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;wavelength_spread&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        
+        <span class="c"># Beam size (as a vector)</span>
+        <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASsource/ns:beam_size&#39;</span><span class="p">,</span> <span class="n">dom</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data_info</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">beam_size_name</span> <span class="o">=</span> <span class="n">entry</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASsource/ns:beam_size/ns:x&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;beam_size.x&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASsource/ns:beam_size/ns:y&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;beam_size.y&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASsource/ns:beam_size/ns:z&#39;</span><span class="p">,</span>
+                     <span class="n">dom</span><span class="p">,</span> <span class="s">&#39;beam_size.z&#39;</span><span class="p">,</span> <span class="n">data_info</span><span class="o">.</span><span class="n">source</span><span class="p">)</span>
+        
+        <span class="c"># Collimation info ###################</span>
+        <span class="n">nodes</span> <span class="o">=</span> <span class="n">dom</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SAScollimation&#39;</span><span class="p">,</span>
+                          <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">nodes</span><span class="p">:</span>
+            <span class="n">collim</span> <span class="o">=</span> <span class="n">Collimation</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">collim</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:length&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="s">&#39;length&#39;</span><span class="p">,</span> <span class="n">collim</span><span class="p">)</span>
+            
+            <span class="c"># Look for apertures</span>
+            <span class="n">apert_list</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:aperture&#39;</span><span class="p">,</span>
+                                    <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+            <span class="k">for</span> <span class="n">apert</span> <span class="ow">in</span> <span class="n">apert_list</span><span class="p">:</span>
+                <span class="n">aperture</span> <span class="o">=</span> <span class="n">Aperture</span><span class="p">()</span>
+                
+                <span class="c"># Get the name and type of the aperture</span>
+                <span class="n">aperture</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">apert</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span>
+                <span class="n">aperture</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">apert</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;type&#39;</span><span class="p">)</span>
+                    
+                <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:distance&#39;</span><span class="p">,</span> <span class="n">apert</span><span class="p">,</span> <span class="s">&#39;distance&#39;</span><span class="p">,</span> <span class="n">aperture</span><span class="p">)</span>
+                
+                <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:size&#39;</span><span class="p">,</span> <span class="n">apert</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">aperture</span><span class="o">.</span><span class="n">size_name</span> <span class="o">=</span> <span class="n">entry</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">)</span>
+                
+                <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:size/ns:x&#39;</span><span class="p">,</span> <span class="n">apert</span><span class="p">,</span> <span class="s">&#39;size.x&#39;</span><span class="p">,</span> <span class="n">aperture</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:size/ns:y&#39;</span><span class="p">,</span> <span class="n">apert</span><span class="p">,</span> <span class="s">&#39;size.y&#39;</span><span class="p">,</span> <span class="n">aperture</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:size/ns:z&#39;</span><span class="p">,</span> <span class="n">apert</span><span class="p">,</span> <span class="s">&#39;size.z&#39;</span><span class="p">,</span> <span class="n">aperture</span><span class="p">)</span>
+                
+                <span class="n">collim</span><span class="o">.</span><span class="n">aperture</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">aperture</span><span class="p">)</span>
+                
+            <span class="n">data_info</span><span class="o">.</span><span class="n">collimation</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">collim</span><span class="p">)</span>
+        
+        <span class="c"># Detector info ######################</span>
+        <span class="n">nodes</span> <span class="o">=</span> <span class="n">dom</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:SASinstrument/ns:SASdetector&#39;</span><span class="p">,</span>
+                          <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">nodes</span><span class="p">:</span>
+            
+            <span class="n">detector</span> <span class="o">=</span> <span class="n">Detector</span><span class="p">()</span>
+            
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_content</span><span class="p">(</span><span class="s">&#39;ns:name&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:SDD&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="s">&#39;distance&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            
+            <span class="c"># Detector offset (as a vector)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:offset/ns:x&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="s">&#39;offset.x&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:offset/ns:y&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="s">&#39;offset.y&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:offset/ns:z&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="s">&#39;offset.z&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            
+            <span class="c"># Detector orientation (as a vector)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:orientation/ns:roll&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span>
+                              <span class="s">&#39;orientation.x&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:orientation/ns:pitch&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span>
+                              <span class="s">&#39;orientation.y&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:orientation/ns:yaw&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span>
+                              <span class="s">&#39;orientation.z&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            
+            <span class="c"># Beam center (as a vector)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:beam_center/ns:x&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span>
+                              <span class="s">&#39;beam_center.x&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:beam_center/ns:y&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span>
+                              <span class="s">&#39;beam_center.y&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:beam_center/ns:z&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span>
+                              <span class="s">&#39;beam_center.z&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            
+            <span class="c"># Pixel size (as a vector)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:pixel_size/ns:x&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span>
+                              <span class="s">&#39;pixel_size.x&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:pixel_size/ns:y&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span>
+                              <span class="s">&#39;pixel_size.y&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:pixel_size/ns:z&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span>
+                              <span class="s">&#39;pixel_size.z&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_float</span><span class="p">(</span><span class="s">&#39;ns:slit_length&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="s">&#39;slit_length&#39;</span><span class="p">,</span> <span class="n">detector</span><span class="p">)</span>
+            
+            <span class="n">data_info</span><span class="o">.</span><span class="n">detector</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">detector</span><span class="p">)</span>
+
+        <span class="c"># Processes info ######################</span>
+        <span class="n">nodes</span> <span class="o">=</span> <span class="n">dom</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:SASprocess&#39;</span><span class="p">,</span> <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">nodes</span><span class="p">:</span>
+            <span class="n">process</span> <span class="o">=</span> <span class="n">Process</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_content</span><span class="p">(</span><span class="s">&#39;ns:name&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">process</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_content</span><span class="p">(</span><span class="s">&#39;ns:date&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="s">&#39;date&#39;</span><span class="p">,</span> <span class="n">process</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_content</span><span class="p">(</span><span class="s">&#39;ns:description&#39;</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="s">&#39;description&#39;</span><span class="p">,</span> <span class="n">process</span><span class="p">)</span>
+            
+            <span class="n">term_list</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:term&#39;</span><span class="p">,</span> <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+            <span class="k">for</span> <span class="n">term</span> <span class="ow">in</span> <span class="n">term_list</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">term_attr</span> <span class="o">=</span> <span class="p">{}</span>
+                    <span class="k">for</span> <span class="n">attr</span> <span class="ow">in</span> <span class="n">term</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                        <span class="n">term_attr</span><span class="p">[</span><span class="n">attr</span><span class="p">]</span> <span class="o">=</span> <span class="n">term</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">attr</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="k">if</span> <span class="n">term</span><span class="o">.</span><span class="n">text</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="n">term_attr</span><span class="p">[</span><span class="s">&#39;value&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">term</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                        <span class="n">process</span><span class="o">.</span><span class="n">term</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">term_attr</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">err_mess</span> <span class="o">=</span> <span class="s">&quot;cansas_reader.read: error processing process term</span><span class="se">\n</span><span class="s">  </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">err_mess</span><span class="p">)</span>
+                    <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">err_mess</span><span class="p">)</span>
+            
+            <span class="n">note_list</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:SASprocessnote&#39;</span><span class="p">,</span>
+                                   <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+            <span class="k">for</span> <span class="n">note</span> <span class="ow">in</span> <span class="n">note_list</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">note</span><span class="o">.</span><span class="n">text</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">process</span><span class="o">.</span><span class="n">notes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">note</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
+            
+            <span class="n">data_info</span><span class="o">.</span><span class="n">process</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">process</span><span class="p">)</span>
+            
+        <span class="c"># Data info ######################</span>
+        <span class="n">nodes</span> <span class="o">=</span> <span class="n">dom</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:SASdata&#39;</span><span class="p">,</span> <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">nodes</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="s">&quot;CanSAS reader is not compatible with multiple SASdata entries&quot;</span>
+       
+        <span class="k">for</span> <span class="n">entry</span> <span class="ow">in</span> <span class="n">nodes</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_data_2d_attr</span><span class="p">:</span>
+                <span class="c">#get node</span>
+                <span class="n">node</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">entry</span><span class="p">)</span>
+                <span class="k">exec</span> <span class="s">&quot;data_info.</span><span class="si">%s</span><span class="s"> = parse_entry_helper(node, item)&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                    
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">list_of_data2d_values</span><span class="p">:</span>
+                <span class="n">field</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">entry</span><span class="p">)</span>
+                <span class="nb">list</span> <span class="o">=</span> <span class="p">[]</span>
+                <span class="k">if</span> <span class="n">field</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="nb">list</span> <span class="o">=</span> <span class="p">[</span><span class="n">parse_entry_helper</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">item</span><span class="p">)</span> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">field</span><span class="p">]</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">:</span>
+                    <span class="k">exec</span> <span class="s">&quot;data_info.</span><span class="si">%s</span><span class="s"> = None&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="k">exec</span> <span class="s">&quot;data_info.</span><span class="si">%s</span><span class="s"> = numpy.array(list)&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        
+        <span class="k">return</span> <span class="n">data_info</span>
+
+    <span class="k">def</span> <span class="nf">_read_cansas</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Load data and P(r) information from a CanSAS XML file.</span>
+<span class="sd">        </span>
+<span class="sd">        :param path: file path</span>
+<span class="sd">        </span>
+<span class="sd">        :return: Data1D object if a single SASentry was found,</span>
+<span class="sd">                    or a list of Data1D objects if multiple entries were found,</span>
+<span class="sd">                    or None of nothing was found</span>
+<span class="sd">                    </span>
+<span class="sd">        :raise RuntimeError: when the file can&#39;t be opened</span>
+<span class="sd">        :raise ValueError: when the length of the data vectors are inconsistent</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">output</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">basename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">root</span><span class="p">,</span> <span class="n">extension</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+        <span class="n">ext</span> <span class="o">=</span> <span class="n">extension</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+                
+                <span class="c">#TODO: eventually remove the check for .xml once</span>
+                <span class="c"># the P(r) writer/reader is truly complete.</span>
+                <span class="k">if</span>  <span class="n">ext</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="ow">or</span> \
+                    <span class="n">ext</span> <span class="o">==</span> <span class="s">&#39;.xml&#39;</span><span class="p">:</span>
+                    
+                    <span class="n">tree</span> <span class="o">=</span> <span class="n">etree</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">parser</span><span class="o">=</span><span class="n">etree</span><span class="o">.</span><span class="n">ETCompatXMLParser</span><span class="p">())</span>
+                    <span class="c"># Check the format version number</span>
+                    <span class="c"># Specifying the namespace will take care of the file format version</span>
+                    <span class="n">root</span> <span class="o">=</span> <span class="n">tree</span><span class="o">.</span><span class="n">getroot</span><span class="p">()</span>
+                    <span class="n">entry_list</span> <span class="o">=</span> <span class="n">root</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:SASentry&#39;</span><span class="p">,</span>
+                                            <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+                    <span class="k">for</span> <span class="n">entry</span> <span class="ow">in</span> <span class="n">entry_list</span><span class="p">:</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="n">sas_entry</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_save_state_entry</span><span class="p">(</span><span class="n">entry</span><span class="p">)</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="k">raise</span>
+                        <span class="n">fitstate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_state</span><span class="p">(</span><span class="n">entry</span><span class="p">)</span>
+                        
+                        <span class="c">#state could be None when .svs file is loaded</span>
+                        <span class="c">#in this case, skip appending to output</span>
+                        <span class="k">if</span> <span class="n">fitstate</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                            <span class="n">sas_entry</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;fitstate&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">fitstate</span>
+                            <span class="n">sas_entry</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="n">fitstate</span><span class="o">.</span><span class="n">file</span>
+                            <span class="n">output</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sas_entry</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">call_back</span><span class="p">(</span><span class="n">format</span><span class="o">=</span><span class="n">ext</span><span class="p">)</span>
+                <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> is not a file&quot;</span> <span class="o">%</span> <span class="n">path</span>
+
+            <span class="c"># Return output consistent with the loader&#39;s api</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">output</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">call_back</span><span class="p">(</span><span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">format</span><span class="o">=</span><span class="n">ext</span><span class="p">)</span>
+                <span class="k">return</span> <span class="bp">None</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">output</span><span class="p">)):</span>
+                    <span class="c"># Call back to post the new state</span>
+                    <span class="n">state</span> <span class="o">=</span> <span class="n">output</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;fitstate&#39;</span><span class="p">]</span>
+                    <span class="n">t</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">timestamp</span><span class="p">)</span>
+                    <span class="n">time_str</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&quot;%b </span><span class="si">%d</span><span class="s"> %H:%M&quot;</span><span class="p">,</span> <span class="n">t</span><span class="p">)</span>
+                    <span class="c"># Check that no time stamp is already appended</span>
+                    <span class="n">max_char</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">file</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&quot;[&quot;</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">max_char</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">max_char</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">file</span><span class="p">)</span>
+                    <span class="n">original_fname</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">file</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="n">max_char</span><span class="p">]</span>
+                    <span class="n">state</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="n">original_fname</span> <span class="o">+</span> <span class="s">&#39; [&#39;</span> <span class="o">+</span> <span class="n">time_str</span> <span class="o">+</span> <span class="s">&#39;]&#39;</span>
+                     
+                    <span class="k">if</span> <span class="n">state</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">state</span><span class="o">.</span><span class="n">is_data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="k">exec</span> <span class="s">&#39;output[</span><span class="si">%d</span><span class="s">].is_data = state.is_data&#39;</span> <span class="o">%</span> <span class="n">ind</span>
+                     
+                    <span class="n">output</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">file</span>
+                    <span class="n">state</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">output</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span>
+                    <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">output</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span><span class="o">.</span><span class="n">filename</span>  <span class="c"># state.data_name</span>
+                    <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">data_id</span>
+                    <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">is_data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">is_data</span>
+                    <span class="k">if</span> <span class="n">output</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span><span class="o">.</span><span class="n">run_name</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span>\
+                        <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">output</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span><span class="o">.</span><span class="n">run_name</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
+                        <span class="n">name</span> <span class="o">=</span> <span class="n">output</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span><span class="o">.</span><span class="n">run_name</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">name</span> <span class="o">=</span> <span class="n">original_fname</span>
+                    <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">name</span>
+                    <span class="c">#store state in fitting</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">call_back</span><span class="p">(</span><span class="n">state</span><span class="o">=</span><span class="n">state</span><span class="p">,</span>
+                                   <span class="n">datainfo</span><span class="o">=</span><span class="n">output</span><span class="p">[</span><span class="n">ind</span><span class="p">],</span> <span class="n">format</span><span class="o">=</span><span class="n">ext</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="n">state</span>
+                <span class="k">return</span> <span class="n">output</span>
+              
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">call_back</span><span class="p">(</span><span class="n">format</span><span class="o">=</span><span class="n">ext</span><span class="p">)</span>
+            <span class="c">#self.state= state</span>
+            <span class="k">raise</span>
+           
+<div class="viewcode-block" id="Reader.write"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.Reader.write">[docs]</a>    <span class="k">def</span> <span class="nf">write</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">fitstate</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Write the content of a Data1D as a CanSAS XML file only for standalone</span>
+<span class="sd">        </span>
+<span class="sd">        :param filename: name of the file to write</span>
+<span class="sd">        :param datainfo: Data1D object</span>
+<span class="sd">        :param fitstate: PageState object</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Sanity check</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cansas</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="c"># Add fitting information to the XML document</span>
+            <span class="n">doc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">write_toXML</span><span class="p">(</span><span class="n">datainfo</span><span class="p">,</span> <span class="n">fitstate</span><span class="p">)</span>
+            <span class="c"># Write the XML document</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">doc</span> <span class="o">=</span> <span class="n">fitstate</span><span class="o">.</span><span class="n">toXML</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="n">filename</span><span class="p">)</span>
+        
+        <span class="c"># Save the document no matter the type</span>
+        <span class="n">fd</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>
+        <span class="n">fd</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">toprettyxml</span><span class="p">())</span>
+        <span class="n">fd</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="Reader.write_toXML"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.pagestate.Reader.write_toXML">[docs]</a>    <span class="k">def</span> <span class="nf">write_toXML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Write toXML, a helper for write(),</span>
+<span class="sd">        could be used by guimanager._on_save()</span>
+<span class="sd">        </span>
+<span class="sd">        : return: xml doc</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data</span> <span class="o">=</span> <span class="n">sas</span><span class="o">.</span><span class="n">dataloader</span><span class="o">.</span><span class="n">data_info</span><span class="o">.</span><span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="p">[],</span> <span class="n">y</span><span class="o">=</span><span class="p">[])</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="ow">not</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c">#make sure title and data run is filled up.</span>
+            <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">title</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">title</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span>
+            <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">run_name</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">run_name</span> <span class="o">==</span> <span class="p">{}:</span>
+                <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">run</span> <span class="o">=</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">)]</span>
+                <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">run_name</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">name</span>
+            
+            <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span>
+                          <span class="n">sas</span><span class="o">.</span><span class="n">dataloader</span><span class="o">.</span><span class="n">data_info</span><span class="o">.</span><span class="n">Data1D</span><span class="p">):</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span>
+                <span class="n">doc</span><span class="p">,</span> <span class="n">sasentry</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_to_xml_doc</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">data</span>
+                <span class="n">doc</span><span class="p">,</span> <span class="n">sasentry</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data2d_to_xml_doc</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            
+        <span class="k">if</span> <span class="n">state</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">doc</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">toXML</span><span class="p">(</span><span class="n">doc</span><span class="o">=</span><span class="n">doc</span><span class="p">,</span> <span class="nb">file</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">filename</span><span class="p">,</span> <span class="n">entry_node</span><span class="o">=</span><span class="n">sasentry</span><span class="p">)</span>
+        
+        <span class="k">return</span> <span class="n">doc</span>
+    
+<span class="c"># Simple html report templet</span></div></div>
+<span class="n">HEADER</span> <span class="o">=</span> <span class="s">&quot;&lt;html&gt;</span><span class="se">\n</span><span class="s">&quot;</span>
+<span class="n">HEADER</span> <span class="o">+=</span> <span class="s">&quot;&lt;head&gt;</span><span class="se">\n</span><span class="s">&quot;</span>
+<span class="n">HEADER</span> <span class="o">+=</span> <span class="s">&quot;&lt;meta http-equiv=Content-Type content=&#39;text/html; &quot;</span>
+<span class="n">HEADER</span> <span class="o">+=</span> <span class="s">&quot;charset=windows-1252&#39;&gt; </span><span class="se">\n</span><span class="s">&quot;</span>
+<span class="n">HEADER</span> <span class="o">+=</span> <span class="s">&quot;&lt;meta name=Generator &gt;</span><span class="se">\n</span><span class="s">&quot;</span>
+<span class="n">HEADER</span> <span class="o">+=</span> <span class="s">&quot;&lt;/head&gt;</span><span class="se">\n</span><span class="s">&quot;</span>
+<span class="n">HEADER</span> <span class="o">+=</span> <span class="s">&quot;&lt;body lang=EN-US&gt;</span><span class="se">\n</span><span class="s">&quot;</span>
+<span class="n">HEADER</span> <span class="o">+=</span> <span class="s">&quot;&lt;div class=WordSection1&gt;</span><span class="se">\n</span><span class="s">&quot;</span>
+<span class="n">HEADER</span> <span class="o">+=</span> <span class="s">&quot;&lt;p class=MsoNormal&gt;&lt;b&gt;&lt;span &gt;&lt;center&gt;&lt;font size=&#39;4&#39; &gt;&quot;</span>
+<span class="n">HEADER</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">&lt;/font&gt;&lt;/center&gt;&lt;/span&gt;&lt;/center&gt;&lt;/b&gt;&lt;/p&gt;&quot;</span>
+<span class="n">HEADER</span> <span class="o">+=</span> <span class="s">&quot;&lt;p class=MsoNormal&gt;&amp;nbsp;&lt;/p&gt;&quot;</span>
+<span class="n">PARA</span> <span class="o">=</span> <span class="s">&quot;&lt;p class=MsoNormal&gt;&lt;font size=&#39;4&#39; &gt; </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span>
+<span class="n">PARA</span> <span class="o">+=</span> <span class="s">&quot;&lt;/font&gt;&lt;/p&gt;&quot;</span>
+<span class="n">CENTRE</span> <span class="o">=</span> <span class="s">&quot;&lt;p class=MsoNormal&gt;&lt;center&gt;&lt;font size=&#39;4&#39; &gt; </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span>
+<span class="n">CENTRE</span> <span class="o">+=</span> <span class="s">&quot;&lt;/font&gt;&lt;/center&gt;&lt;/p&gt;&quot;</span>
+<span class="n">FEET_1</span> <span class="o">=</span> \
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">&lt;p class=MsoNormal&gt;&amp;nbsp;&lt;/p&gt;</span>
+<span class="sd">&lt;br&gt;</span>
+<span class="sd">&lt;p class=MsoNormal&gt;&lt;b&gt;&lt;span &gt;&lt;center&gt; &lt;font size=&#39;4&#39; &gt; Graph</span>
+<span class="sd">&lt;/font&gt;&lt;/span&gt;&lt;/center&gt;&lt;/b&gt;&lt;/p&gt;</span>
+<span class="sd">&lt;p class=MsoNormal&gt;&amp;nbsp;&lt;/p&gt;</span>
+<span class="sd">&lt;center&gt;</span>
+<span class="sd">&lt;br&gt;&lt;font size=&#39;4&#39; &gt;Model Computation&lt;/font&gt;</span>
+<span class="sd">&lt;br&gt;&lt;font size=&#39;4&#39; &gt;Data: &quot;%s&quot;&lt;/font&gt;&lt;br&gt;</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="n">FEET_2</span> <span class="o">=</span> \
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">&lt;img src=&quot;%s&quot; &gt;</span>
+<span class="sd">&lt;/img&gt;</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="n">FEET_3</span> <span class="o">=</span> \
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">&lt;/center&gt;</span>
+<span class="sd">&lt;/div&gt;</span>
+<span class="sd">&lt;/body&gt;</span>
+<span class="sd">&lt;/html&gt;</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="n">ELINE</span> <span class="o">=</span> <span class="s">&quot;&lt;p class=MsoNormal&gt;&amp;nbsp;&lt;/p&gt;&quot;</span>
+
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>
+    <span class="n">state</span> <span class="o">=</span> <span class="n">PageState</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+    <span class="c">#state.toXML()</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    </span>
+<span class="sd">    file = open(&quot;test_state&quot;, &quot;w&quot;)</span>
+<span class="sd">    pickle.dump(state, file)</span>
+<span class="sd">    print pickle.dumps(state)</span>
+<span class="sd">    state.data_name = &quot;hello----&gt;&quot;</span>
+<span class="sd">    pickle.dump(state, file)</span>
+<span class="sd">    file = open(&quot;test_state&quot;, &quot;r&quot;)</span>
+<span class="sd">    new_state= pickle.load(file)</span>
+<span class="sd">    print &quot;new state&quot;, new_state</span>
+<span class="sd">    new_state= pickle.load(file)</span>
+<span class="sd">    print &quot;new state&quot;, new_state</span>
+<span class="sd">    #print &quot;state&quot;, state</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="kn">import</span> <span class="nn">bsddb</span>
+    <span class="kn">import</span> <span class="nn">pickle</span>
+    <span class="n">db</span> <span class="o">=</span> <span class="n">bsddb</span><span class="o">.</span><span class="n">btopen</span><span class="p">(</span><span class="s">&#39;file_state.db&#39;</span><span class="p">,</span> <span class="s">&#39;c&#39;</span><span class="p">)</span>
+    <span class="n">val</span> <span class="o">=</span> <span class="p">(</span><span class="n">pickle</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">state</span><span class="p">),</span> <span class="s">&quot;hello&quot;</span><span class="p">,</span> <span class="s">&quot;hi&quot;</span><span class="p">)</span>
+    <span class="n">db</span><span class="p">[</span><span class="s">&#39;state1&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">pickle</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
+    <span class="k">print</span> <span class="n">pickle</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="n">db</span><span class="p">[</span><span class="s">&#39;state1&#39;</span><span class="p">])</span>
+    <span class="n">state</span><span class="o">.</span><span class="n">data_name</span> <span class="o">=</span> <span class="s">&quot;hello----&gt;22&quot;</span>
+    <span class="n">db</span><span class="p">[</span><span class="s">&#39;state2&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">pickle</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+    <span class="n">state</span><span class="o">.</span><span class="n">data_name</span> <span class="o">=</span> <span class="s">&quot;hello----&gt;2&quot;</span>
+    <span class="n">db</span><span class="p">[</span><span class="s">&#39;state3&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">pickle</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+    <span class="k">del</span> <span class="n">db</span><span class="p">[</span><span class="s">&#39;state3&#39;</span><span class="p">]</span>
+    <span class="n">state</span><span class="o">.</span><span class="n">data_name</span> <span class="o">=</span> <span class="s">&quot;hello----&gt;3&quot;</span>
+    <span class="n">db</span><span class="p">[</span><span class="s">&#39;state4&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">pickle</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+    <span class="n">new_state</span> <span class="o">=</span> <span class="n">pickle</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="n">db</span><span class="p">[</span><span class="s">&#39;state1&#39;</span><span class="p">])</span>
+    <span class="c">#print db.last()</span>
+    <span class="n">db</span><span class="o">.</span><span class="n">set_location</span><span class="p">(</span><span class="s">&#39;state2&#39;</span><span class="p">)</span>
+    <span class="n">state</span><span class="o">.</span><span class="n">data_name</span> <span class="o">=</span> <span class="s">&quot;hello----&gt;5&quot;</span>
+    <span class="n">db</span><span class="p">[</span><span class="s">&#39;aastate5&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">pickle</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+    <span class="n">db</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
+    <span class="k">print</span> <span class="n">pickle</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="n">db</span><span class="p">[</span><span class="s">&#39;state2&#39;</span><span class="p">])</span>
+  
+    <span class="n">db</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/plugin_models/polynomial5.html
===================================================================
--- _modules/sas/perspectives/fitting/plugin_models/polynomial5.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/plugin_models/polynomial5.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,212 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.plugin_models.polynomial5 &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.plugin_models.polynomial5</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Test plug-in model</span>
+<span class="sd">These are links of available functions:</span>
+
+<span class="sd">http://docs.python.org/library/math.html</span>
+<span class="sd">http://www.scipy.org/Numpy_Functions_by_Category</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">Please select the &#39;Compile&#39; from the menubar after the modification and saving.</span>
+<span class="sd">Note that we recommend to save the file as a different file name.</span>
+<span class="sd">Otherwise, it could be removed in the future on re-installation of the SasView.</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">from</span> <span class="nn">sas.models.pluginmodel</span> <span class="kn">import</span> <span class="n">Model1DPlugin</span>  <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+
+<span class="c">## FOR MORE INFORMATION CHECK http://docs.python.org/library/math.html      </span>
+<span class="c">## AND http://www.scipy.org/Numpy_Functions_by_Category</span>
+<span class="kn">import</span> <span class="nn">math</span>                    <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+<span class="kn">import</span> <span class="nn">numpy</span>                   <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="c">## &lt;-----  SIGN DEFINES WHERE YOU CAN MODIFY THE CODE</span>
+
+<div class="viewcode-block" id="Model"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.polynomial5.Model">[docs]</a><span class="k">class</span> <span class="nc">Model</span><span class="p">(</span><span class="n">Model1DPlugin</span><span class="p">):</span> <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    ##YOU CAN BE MODIFY ANYTHING BETWEEN &quot;&quot;&quot;</span> <span class="s">&quot;&quot;&quot;</span>
+<span class="s">    ##DESCRIPTION OF MODEL PLUG-IN GOES HERE</span>
+<span class="s">    </span>
+<span class="s">    ##EXAMPLE: Class that evaluates a polynomial model. </span>
+<span class="s">    &quot;&quot;&quot;</span>
+    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>  
+                                
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>      <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialization</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">Model1DPlugin</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        
+        <span class="c">## HERE WE DEFINE THE PARAM NAME AND ITS INITIAL VALUE </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER                                                      </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.1</span>       <span class="c">## &lt;-----                </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;B&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">10.0</span>      <span class="c">## &lt;-----                 </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;C&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>       <span class="c">## &lt;-----                </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;D&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>       <span class="c">## &lt;-----                    </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;E&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>       <span class="c">## &lt;-----                  </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;F&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>       <span class="c">## &lt;-----   </span>
+        <span class="c"># Set the name same as the file name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_fname</span><span class="p">()</span>     <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.MODIFY WORDS BETWEEN &quot;&quot;&quot;   &quot;&quot;&quot;  ONLY!!!!</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">description</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;</span>
+<span class="s">            a + b * x + c * math.pow(x,2) + d * math.pow(x,3) </span><span class="se">\n</span><span class="s"></span>
+<span class="s">             + e * math.pow(x,4) + f * math.pow(x,5)  </span>
+<span class="s">        &quot;&quot;&quot;</span>                        <span class="c">## &lt;-----   </span>
+        <span class="c">## DEFINE DEFAULT DETAILS</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_details</span><span class="p">()</span>      <span class="c">##DO NOT DELETE OR CHANGE THIS LINE!!!</span>
+        
+        <span class="c">## IN THIS EXAMPLE THE FUNTION IS:</span>
+        <span class="c">## F(x)=A+B*x+C*x^2+D*x^3+E*x^4+F*x^5             </span>
+   
+<div class="viewcode-block" id="Model.function"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.polynomial5.Model.function">[docs]</a>    <span class="k">def</span> <span class="nf">function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">):</span> <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Evaluate the model</span>
+<span class="sd">        :param x: input x</span>
+<span class="sd">        :return: function value</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## DEFINE YOUR FUNCTION HERE.</span>
+        <span class="c">## YOU CAN ERASE EVERYTHING BELLOW FOR YOUR OWN FUNCTION</span>
+        <span class="c">#Redefine parameters as local parameters, or skip and use long name</span>
+        <span class="n">a</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">b</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;B&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">c</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;C&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">d</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;D&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">e</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;E&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">f</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;F&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+ 
+        <span class="c">##THIS OUR FUNCTION TEMPLATE</span>
+        <span class="n">poly</span> <span class="o">=</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span> <span class="o">*</span> <span class="n">x</span> <span class="o">+</span> <span class="n">c</span> <span class="o">*</span> <span class="n">math</span><span class="o">.</span><span class="n">pow</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="n">d</span> <span class="o">*</span> <span class="n">math</span><span class="o">.</span><span class="n">pow</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span> \
+                <span class="o">+</span> <span class="n">e</span> <span class="o">*</span> <span class="n">math</span><span class="o">.</span><span class="n">pow</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="mi">4</span><span class="p">)</span> <span class="o">+</span> <span class="n">f</span> <span class="o">*</span> <span class="n">math</span><span class="o">.</span><span class="n">pow</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>              <span class="c">## &lt;-----                </span>
+        
+        <span class="c">#(Just note: In Python, indentation defines the belongings </span>
+        <span class="c"># of &#39;if&#39;, &#39;for&#39;, and so on..)</span>
+        <span class="c">#(lim x --&gt; 0) </span>
+        <span class="k">if</span> <span class="n">x</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>                          <span class="c">## &lt;-----   </span>
+            <span class="n">result</span> <span class="o">=</span> <span class="n">a</span>                      <span class="c">## &lt;-----   </span>
+        <span class="k">else</span><span class="p">:</span>                               <span class="c">## &lt;-----   </span>
+            <span class="n">result</span> <span class="o">=</span> <span class="n">poly</span>                   <span class="c">## &lt;-----    </span>
+
+        <span class="k">return</span> <span class="n">result</span>       <span class="c">## MODIFY ONLY RESULT. DON&#39;T DELETE RETURN!!!!</span>
+    
+    <span class="c">## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       </span></div>
+<div class="viewcode-block" id="Model.get_fname"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.polynomial5.Model.get_fname">[docs]</a>    <span class="k">def</span> <span class="nf">get_fname</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the model name same as the file name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">_getframe</span><span class="p">()</span><span class="o">.</span><span class="n">f_code</span><span class="o">.</span><span class="n">co_filename</span>
+        <span class="n">basename</span>  <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">name</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">name</span>
+            
+<span class="c">###############################################################################</span>
+<span class="c">## THIS IS FOR TEST. DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       </span></div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">m</span><span class="o">=</span> <span class="n">Model</span><span class="p">()</span> 
+    <span class="n">out1</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.0</span><span class="p">)</span>
+    <span class="n">out2</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>
+    <span class="n">isfine1</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">out1</span><span class="p">)</span>
+    <span class="n">isfine2</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">out2</span><span class="p">)</span>
+    <span class="k">print</span> <span class="s">&quot;Testing the value at Q = 0.0:&quot;</span>
+    <span class="k">print</span> <span class="n">out1</span><span class="p">,</span> <span class="s">&quot; : finite? &quot;</span><span class="p">,</span> <span class="n">isfine1</span>
+    <span class="k">print</span> <span class="s">&quot;Testing the value at Q = 0.01:&quot;</span>
+    <span class="k">print</span> <span class="n">out2</span><span class="p">,</span> <span class="s">&quot; : finite? &quot;</span><span class="p">,</span> <span class="n">isfine2</span>
+    <span class="k">if</span> <span class="n">isfine1</span> <span class="ow">and</span> <span class="n">isfine2</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Passed!&quot;</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Failed!&quot;</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/plugin_models/sph_bessel_jn.html
===================================================================
--- _modules/sas/perspectives/fitting/plugin_models/sph_bessel_jn.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/plugin_models/sph_bessel_jn.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,235 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.plugin_models.sph_bessel_jn &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.plugin_models.sph_bessel_jn</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Test plug-in model</span>
+<span class="sd">These are links of available functions:</span>
+
+<span class="sd">http://docs.python.org/library/math.html</span>
+<span class="sd">http://www.scipy.org/Numpy_Functions_by_Category</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">Please select the &#39;Compile&#39; from the menubar after the modification and saving.</span>
+<span class="sd">Note that we recommend to save the file as a different file name.</span>
+<span class="sd">Otherwise, it could be removed in the future on re-installation of the SasView.</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">from</span> <span class="nn">sas.models.pluginmodel</span> <span class="kn">import</span> <span class="n">Model1DPlugin</span>  <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+<span class="kn">import</span> <span class="nn">math</span>                  <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+<span class="kn">import</span> <span class="nn">numpy</span>                 <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+<span class="kn">import</span> <span class="nn">scipy.special</span>            <span class="c">##CHANGE THIS LINE WITH CAUTION!!!</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="c">##PLEASE READ COMMENTS CAREFULLY !!! COMMENT ARE IN CAPITAL LETTERS AND AFTER ##</span>
+<span class="c">## THESE COMMENTS ARE THERE TO GUIDE YOU. YOU CAN REMOVE THEM ONLY WHEN YOU ARE</span>
+<span class="c">## CONFORTABLE ENOUGH WITH OUR MODEL PLUGIN OPTION</span>
+
+
+<span class="c">## &lt;-----  SIGN DEFINES WHERE YOU CAN MODIFY THE CODE</span>
+
+<div class="viewcode-block" id="Model"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sph_bessel_jn.Model">[docs]</a><span class="k">class</span> <span class="nc">Model</span><span class="p">(</span><span class="n">Model1DPlugin</span><span class="p">):</span> <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    ##YOU CAN BE MODIFY ANYTHING BETWEEN &quot;&quot;&quot;</span> <span class="s">&quot;&quot;&quot;</span>
+<span class="s">    ##DESCRIPTION OF MODEL PLUG-IN GOES HERE</span>
+<span class="s">    </span>
+<span class="s">    ##EXAMPLE: Class that evaluates a polynomial model. </span>
+<span class="s">    &quot;&quot;&quot;</span>
+    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span> 
+                                
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>      <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialization</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">Model1DPlugin</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        
+        <span class="c">## EDIT PARAMETERS&#39; NAMES AND VALUE</span>
+        <span class="c">## DELETE MODIFIABLE LINE HERE WILL REDUCE THE NUMBER OF PARAMETERS</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span> <span class="o">=</span> <span class="p">{}</span>                <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="c"># Set the name same as the file name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_fname</span><span class="p">()</span>     <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;C&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>   <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE                                                      </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>       <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE                 </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;B&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>      <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE                 </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;D&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>      <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE                 </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;n&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span>      <span class="c">## &lt;----- </span>
+ 
+        <span class="c">## DEFINE DEFAULT DETAILS</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_details</span><span class="p">()</span>      <span class="c">##DO NOT DELETE OR CHANGE THIS LINE!!!</span>
+        
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.MODIFY WORDS BETWEEN &quot;&quot;&quot;   &quot;&quot;&quot;  ONLY!!!!</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">description</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;</span>
+<span class="s">            Spherical Bessel Function: C*sph_jn(n, Ax+B)+D</span>
+<span class="s">                 &quot;&quot;&quot;</span>                        <span class="c">## &lt;-----   </span>
+   
+<div class="viewcode-block" id="Model.function"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sph_bessel_jn.Model.function">[docs]</a>    <span class="k">def</span> <span class="nf">function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">):</span> <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Evaluate the model</span>
+<span class="sd">        </span>
+<span class="sd">        :param x: input x</span>
+<span class="sd">        </span>
+<span class="sd">        :return: function value</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## ADD YOUR FUNCTION HERE.</span>
+        <span class="c">## REUSE THE PARAMETERS DEFINED PREVIOUSLY TO WRITE YOUR FUNCTION.</span>
+        
+        <span class="c">## IN THIS EXAMPLE THE FUNTION IS:</span>
+        <span class="c">## C*sph_jn(Ax+B)+D</span>
+         
+        <span class="c">## NOTE: pow IS A FUNCTION IMPORTED FROM PYTHON MATH LIBRARY</span>
+        <span class="c">## FOR MORE INFORMATION CHECK http://docs.python.org/library/math.html      </span>
+        <span class="c">## OTHER FUNCTIONS ARE ALSO </span>
+        <span class="c">###  AVAILABLE http://www.scipy.org/Numpy_Functions_by_Category</span>
+        <span class="c">## numpy FUNCTIONS ARE FOR EXPERT USER</span>
+        
+        <span class="c">## YOU CAN ERASE EVERYTHING BELLOW FOR YOUR OWN FUNCTION</span>
+        <span class="c">#Redefine parameters as local parameters</span>
+        <span class="n">a</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">b</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;B&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">c</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;C&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">d</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;D&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="c"># Take integer value only</span>
+        <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;n&#39;</span><span class="p">])</span>      <span class="c">## &lt;-----   </span>
+
+        <span class="c">##THIS OUR FUNCTION TEMPLATE</span>
+        <span class="c">#Remove a singular point (lim poly --&gt; 0) for sin(poly)/poly</span>
+        <span class="c">#(Just note: In Python, indentation defines the belongings of &#39;if&#39;, &#39;for&#39;, and so on..)</span>
+        <span class="nb">input</span> <span class="o">=</span> <span class="n">a</span> <span class="o">*</span> <span class="n">x</span> <span class="o">+</span> <span class="n">b</span>
+        <span class="c"># sph_out and _ are in array types from scipy upto n&#39;th order</span>
+        <span class="c"># where _ is not used for this function.</span>
+        <span class="n">sph_out</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">scipy</span><span class="o">.</span><span class="n">special</span><span class="o">.</span><span class="n">sph_jn</span><span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">input</span><span class="p">)</span>
+        <span class="c"># Take only n&#39;th value</span>
+        <span class="n">result</span> <span class="o">=</span> <span class="n">c</span> <span class="o">*</span> <span class="n">sph_out</span><span class="p">[</span><span class="n">n</span><span class="p">]</span> <span class="o">+</span> <span class="n">d</span>      <span class="c">## &lt;-----                </span>
+
+        <span class="k">return</span> <span class="n">result</span> <span class="c">## MODIFY ONLY RESULT. DON&#39;T DELETE RETURN!!!!</span>
+    
+    <span class="c">## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!      </span></div>
+<div class="viewcode-block" id="Model.get_fname"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sph_bessel_jn.Model.get_fname">[docs]</a>    <span class="k">def</span> <span class="nf">get_fname</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the model name same as the file name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">_getframe</span><span class="p">()</span><span class="o">.</span><span class="n">f_code</span><span class="o">.</span><span class="n">co_filename</span>
+        <span class="n">basename</span>  <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">name</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">name</span>
+            
+<span class="c">###############################################################################   </span>
+<span class="c">## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       </span></div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">m</span><span class="o">=</span> <span class="n">Model</span><span class="p">()</span> 
+    <span class="n">out1</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.0</span><span class="p">)</span>
+    <span class="n">out2</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>
+    <span class="n">isfine1</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">out1</span><span class="p">)</span>
+    <span class="n">isfine2</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">out2</span><span class="p">)</span>
+    <span class="k">print</span> <span class="s">&quot;Testing the value at Q = 0.0:&quot;</span>
+    <span class="k">print</span> <span class="n">out1</span><span class="p">,</span> <span class="s">&quot; : finite? &quot;</span><span class="p">,</span> <span class="n">isfine1</span>
+    <span class="k">print</span> <span class="s">&quot;Testing the value at Q = 0.01:&quot;</span>
+    <span class="k">print</span> <span class="n">out2</span><span class="p">,</span> <span class="s">&quot; : finite? &quot;</span><span class="p">,</span> <span class="n">isfine2</span>
+    <span class="k">if</span> <span class="n">isfine1</span> <span class="ow">and</span> <span class="n">isfine2</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Passed!&quot;</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Failed!&quot;</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/plugin_models/sum_Ap1_1_Ap2.html
===================================================================
--- _modules/sas/perspectives/fitting/plugin_models/sum_Ap1_1_Ap2.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/plugin_models/sum_Ap1_1_Ap2.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,517 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2 &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2</h1><div class="highlight"><pre>
+<span class="c"># A sample of an experimental model function for Sum(APmodel1,(1-A)Pmodel2)</span>
+<span class="kn">import</span> <span class="nn">copy</span>
+<span class="kn">from</span> <span class="nn">sas.models.pluginmodel</span> <span class="kn">import</span> <span class="n">Model1DPlugin</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">Please select the &#39;Compile&#39; from the menubar after the modification and saving.</span>
+<span class="sd">Note that we recommend to save the file as a different file name.</span>
+<span class="sd">Otherwise, it could be removed in the future on re-installation of the SasView.</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="c"># Available model names for this sum model</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">BCCrystalModel, BEPolyelectrolyte, BarBellModel, BinaryHSModel, BroadPeakModel,</span>
+<span class="sd">CSParallelepipedModel, CappedCylinderModel, CoreShellCylinderModel,</span>
+<span class="sd">CoreShellEllipsoidModel, CoreShellModel, CorrLengthModel, CylinderModel, </span>
+<span class="sd">DABModel, DebyeModel, EllipsoidModel, EllipticalCylinderModel, FCCrystalModel,</span>
+<span class="sd">FlexCylEllipXModel, FlexibleCylinderModel, FractalCoreShellModel, FractalModel,</span>
+<span class="sd">FuzzySphereModel, GaussLorentzGelModel, GuinierModel, GuinierPorodModel,</span>
+<span class="sd">HardsphereStructure, HayterMSAStructure, HollowCylinderModel, LamellarFFHGModel,</span>
+<span class="sd">LamellarModel, LamellarPCrystalModel, LamellarPSHGModel, LamellarPSModel,</span>
+<span class="sd">LineModel, LorentzModel, MultiShellModel, ParallelepipedModel, PeakGaussModel,</span>
+<span class="sd">PeakLorentzModel, PearlNecklaceModel, Poly_GaussCoil, PolymerExclVolume,</span>
+<span class="sd">PorodModel, PowerLawAbsModel, SCCrystalModel, SphereModel, SquareWellStructure,</span>
+<span class="sd">StackedDisksModel, StickyHSStructure, TeubnerStreyModel, TriaxialEllipsoidModel,</span>
+<span class="sd">TwoLorentzianModel, TwoPowerLawModel, VesicleModel</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c">## This model is DIFFERENT from the Easy Custom Sum(p1 + p2) </span>
+<span class="c">## by definition of the scale factor *****************************************</span>
+<span class="c">#</span>
+<span class="c">#     Custom model = scale_factor * P1 + (1 - scale_factor) * P2</span>
+<span class="c">#</span>
+<span class="c">## User can REPLACE model names below arrowed two lines (twice per line)</span>
+<span class="kn">from</span> <span class="nn">sas.models.CylinderModel</span> <span class="kn">import</span> <span class="n">CylinderModel</span> <span class="k">as</span> <span class="n">P1</span>          <span class="c">#&lt;========</span>
+<span class="kn">from</span> <span class="nn">sas.models.PolymerExclVolume</span> <span class="kn">import</span> <span class="n">PolymerExclVolume</span> <span class="k">as</span> <span class="n">P2</span>  <span class="c">#&lt;========</span>
+
+<span class="c">#####DO NOT CHANGE ANYTHING BELOW THIS LINE </span>
+<span class="c">#####---------------------------------------------------------------------------</span>
+<div class="viewcode-block" id="Model"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2.Model">[docs]</a><span class="k">class</span> <span class="nc">Model</span><span class="p">(</span><span class="n">Model1DPlugin</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Use for A*p1(Q)+(1-A)*p2(Q); </span>
+<span class="sd">    Note: P(Q) refers to &#39;form factor&#39; model.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>  
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="n">Model1DPlugin</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :param p_model1: a form factor, P(Q)</span>
+<span class="sd">        :param p_model2: another form factor, P(Q)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">p_model1</span> <span class="o">=</span> <span class="n">P1</span><span class="p">()</span>
+        <span class="n">p_model2</span> <span class="o">=</span> <span class="n">P2</span><span class="p">()</span>
+        <span class="c">## Setting  model name model description</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">description</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_description</span><span class="p">(</span><span class="n">p_model1</span><span class="p">,</span> <span class="n">p_model2</span><span class="p">)</span>
+        <span class="c"># Set the name same as the file name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_fname</span><span class="p">()</span>     <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="c">## Define parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span> <span class="o">=</span> <span class="p">{}</span>
+
+        <span class="c">## Parameter details [units, min, max]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c">## Magnetic Panrameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_params</span> <span class="o">=</span> <span class="p">[]</span>
+        
+        <span class="c"># non-fittable parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">non_fittable</span> <span class="o">=</span> <span class="n">p_model1</span><span class="o">.</span><span class="n">non_fittable</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">non_fittable</span> <span class="o">+=</span> <span class="n">p_model2</span><span class="o">.</span><span class="n">non_fittable</span>  
+            
+        <span class="c">##models </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">=</span> <span class="n">p_model1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">=</span> <span class="n">p_model2</span>
+        
+       
+        <span class="c">## dispersion</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_dispersion</span><span class="p">()</span>
+        <span class="c">## Define parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_params</span><span class="p">()</span>
+        <span class="c">## New parameter:Scaling factor</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.5</span>
+        
+        <span class="c">## Parameter details [units, min, max]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_details</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;&#39;</span><span class="p">,</span>     <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>
+
+        
+        <span class="c">#list of parameter that can be fitted</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_fixed_params</span><span class="p">()</span>  
+        <span class="c">## parameters with orientation</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p1_&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">new_item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+            
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p2_&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">new_item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+        <span class="c">## magnetic params</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p1_&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">new_item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_params</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+            
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p2_&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">new_item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_params</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+        <span class="c"># set multiplicity 1: muti_func Not supported.</span>
+        <span class="n">multiplicity1</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="n">multiplicity2</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="c">## functional multiplicity of the model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplicity1</span> <span class="o">=</span> <span class="n">multiplicity1</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplicity2</span> <span class="o">=</span> <span class="n">multiplicity2</span>    
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplicity_info</span> <span class="o">=</span> <span class="p">[]</span>   
+        
+    <span class="k">def</span> <span class="nf">_clone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Internal utility function to copy the internal</span>
+<span class="sd">            data members to a fresh copy.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">params</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="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">description</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="bp">self</span><span class="o">.</span><span class="n">description</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">details</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="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dispersion</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="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">p_model1</span>  <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">p_model2</span>  <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="c">#obj = copy.deepcopy(self)</span>
+        <span class="k">return</span> <span class="n">obj</span>
+    
+    <span class="k">def</span> <span class="nf">_get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name1</span><span class="p">,</span> <span class="n">name2</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get combined name from two model names</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;A*&quot;</span>
+        <span class="n">p1_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_upper_name</span><span class="p">(</span><span class="n">name1</span><span class="p">)</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">p1_name</span><span class="p">:</span>
+            <span class="n">p1_name</span> <span class="o">=</span> <span class="n">name1</span>
+        <span class="n">name</span> <span class="o">+=</span> <span class="n">p1_name</span>
+        <span class="n">name</span> <span class="o">+=</span> <span class="s">&quot;+(1-A)*&quot;</span>
+        <span class="n">p2_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_upper_name</span><span class="p">(</span><span class="n">name2</span><span class="p">)</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">p2_name</span><span class="p">:</span>
+            <span class="n">p2_name</span> <span class="o">=</span> <span class="n">name2</span>
+        <span class="n">name</span> <span class="o">+=</span> <span class="n">p2_name</span>
+        <span class="k">return</span> <span class="n">name</span>
+    
+    <span class="k">def</span> <span class="nf">_get_upper_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get uppercase string from model name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> <span class="s">&quot;&quot;</span>
+        <span class="n">upper_name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">str_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">index</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">str_name</span><span class="p">)):</span>
+            <span class="k">if</span> <span class="n">str_name</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">isupper</span><span class="p">():</span>
+                <span class="n">upper_name</span> <span class="o">+=</span> <span class="n">str_name</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+        <span class="k">return</span> <span class="n">upper_name</span>
+        
+    <span class="k">def</span> <span class="nf">_set_dispersion</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">           combined the two models dispersions</span>
+<span class="sd">           Polydispersion should not be applied to s_model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">##set dispersion only from p_model </span>
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c">#if name.lower() not in self.p_model1.orientation_params:</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p1_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">value</span> 
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c">#if name.lower() not in self.p_model2.orientation_params:</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p2_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">value</span> 
+            
+<div class="viewcode-block" id="Model.function"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2.Model.function">[docs]</a>    <span class="k">def</span> <span class="nf">function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="o">=</span><span class="mf">0.0</span><span class="p">):</span> 
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="mi">0</span>
+                               </div>
+<div class="viewcode-block" id="Model.getProfile"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2.Model.getProfile">[docs]</a>    <span class="k">def</span> <span class="nf">getProfile</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get SLD profile of p_model if exists</span>
+<span class="sd">        </span>
+<span class="sd">        : return: (r, beta) where r is a list of radius of the transition points</span>
+<span class="sd">                beta is a list of the corresponding SLD values </span>
+<span class="sd">        : Note: This works only for func_shell# = 2 (exp function)</span>
+<span class="sd">                and is not supporting for p2</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">x</span><span class="p">,</span><span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">getProfile</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">x</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">y</span> <span class="o">=</span> <span class="bp">None</span>
+            
+        <span class="k">return</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_set_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Concatenate the parameters of the two models to create</span>
+<span class="sd">            this model parameters </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c"># No 2D-supported</span>
+            <span class="c">#if name not in self.p_model1.orientation_params:</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p1_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">value</span>
+            
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c"># No 2D-supported</span>
+            <span class="c">#if name not in self.p_model2.orientation_params:</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p2_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">value</span>
+                
+        <span class="c"># Set &quot;scale&quot; as initializing</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_scale_factor</span><span class="p">()</span>
+      
+            
+    <span class="k">def</span> <span class="nf">_set_details</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Concatenate details of the two models to create</span>
+<span class="sd">            this model details </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span><span class="n">detail</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">details</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p1_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="c">#if new_name not in self.orientation_params:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">detail</span>
+            
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span><span class="n">detail</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">details</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p2_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="c">#if new_name not in self.orientation_params:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">detail</span>
+    
+    <span class="k">def</span> <span class="nf">_set_scale_factor</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Not implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">pass</span>
+        
+                
+<div class="viewcode-block" id="Model.setParam"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2.Model.setParam">[docs]</a>    <span class="k">def</span> <span class="nf">setParam</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Set the value of a model parameter</span>
+<span class="sd">    </span>
+<span class="sd">        :param name: name of the parameter</span>
+<span class="sd">        :param value: value of the parameter</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># set param to p1+p2 model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_setParamHelper</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+        
+        <span class="c">## setParam to p model </span>
+        <span class="n">model_pre</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;_&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">new_name</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;_&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">model_pre</span> <span class="o">==</span> <span class="s">&quot;p1&quot;</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">new_name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">getParamList</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">new_name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">model_pre</span> <span class="o">==</span> <span class="s">&quot;p2&quot;</span><span class="p">:</span>
+             <span class="k">if</span> <span class="n">new_name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">getParamList</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">new_name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;scale_factor&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;Model does not contain parameter </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">name</span>
+            </div>
+<div class="viewcode-block" id="Model.getParam"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2.Model.getParam">[docs]</a>    <span class="k">def</span> <span class="nf">getParam</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Set the value of a model parameter</span>
+
+<span class="sd">        :param name: name of the parameter</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Look for dispersion parameters</span>
+        <span class="n">toks</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">toks</span><span class="p">)</span><span class="o">==</span><span class="mi">2</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="c"># 2D not supported</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">==</span><span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span><span class="c"># and \</span>
+                            <span class="c">#item.lower() not in self.orientation_params \</span>
+                            <span class="c">#and toks[0].lower() not in self.orientation_params:</span>
+                    <span class="k">for</span> <span class="n">par</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">item</span><span class="p">]:</span>
+                        <span class="k">if</span> <span class="n">par</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="n">toks</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span>
+                            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">par</span><span class="p">]</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># Look for standard parameter</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">==</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span><span class="c">#and \</span>
+                            <span class="c">#item.lower() not in self.orientation_params \</span>
+                            <span class="c">#and toks[0].lower() not in self.orientation_params:</span>
+                    <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="n">item</span><span class="p">]</span>
+        <span class="k">return</span>  
+        <span class="c">#raise ValueError, &quot;Model does not contain parameter %s&quot; % name</span>
+       </div>
+    <span class="k">def</span> <span class="nf">_setParamHelper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Helper function to setparam</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Look for dispersion parameters</span>
+        <span class="n">toks</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">toks</span><span class="p">)</span><span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">==</span> <span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span><span class="c"># and \</span>
+                            <span class="c">#item.lower() not in self.orientation_params:</span>
+                    <span class="k">for</span> <span class="n">par</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">item</span><span class="p">]:</span>
+                        <span class="k">if</span> <span class="n">par</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="n">toks</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span><span class="c">#and \</span>
+                                <span class="c">#item.lower() not in self.orientation_params:</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">par</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
+                            <span class="k">return</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># Look for standard parameter</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">==</span> <span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span><span class="c">#and \</span>
+                            <span class="c">#item.lower() not in self.orientation_params:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
+                    <span class="k">return</span>
+            
+        <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;Model does not contain parameter </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">name</span>
+             
+   
+    <span class="k">def</span> <span class="nf">_set_fixed_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">             fill the self.fixed list with the p_model fixed list</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">fixed</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p1&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fixed</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">fixed</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p2&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fixed</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">fixed</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
+                
+                    
+<div class="viewcode-block" id="Model.run"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2.Model.run">[docs]</a>    <span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Evaluate the model</span>
+<span class="sd">        </span>
+<span class="sd">        :param x: input q-value (float or [float, float] as [r, theta])</span>
+<span class="sd">        :return: (scattering function value)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_scale_factor</span><span class="p">()</span>
+        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> \
+                <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">])</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+    </div>
+<div class="viewcode-block" id="Model.runXY"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2.Model.runXY">[docs]</a>    <span class="k">def</span> <span class="nf">runXY</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Evaluate the model</span>
+<span class="sd">        </span>
+<span class="sd">        :param x: input q-value (float or [float, float] as [qx, qy])</span>
+<span class="sd">        :return: scattering function value</span>
+<span class="sd">        &quot;&quot;&quot;</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_scale_factor</span><span class="p">()</span>
+        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> \
+                <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">])</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+    
+    <span class="c">## Now (May27,10) directly uses the model eval function </span>
+    <span class="c">## instead of the for-loop in Base Component.</span></div>
+<div class="viewcode-block" id="Model.evalDistribution"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2.Model.evalDistribution">[docs]</a>    <span class="k">def</span> <span class="nf">evalDistribution</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="p">[]):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Evaluate the model in cartesian coordinates</span>
+<span class="sd">        </span>
+<span class="sd">        :param x: input q[], or [qx[], qy[]]</span>
+<span class="sd">        :return: scattering function P(q[])</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_scale_factor</span><span class="p">()</span>
+        <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">evalDistribution</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> \
+                <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">])</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">evalDistribution</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+</div>
+<div class="viewcode-block" id="Model.set_dispersion"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2.Model.set_dispersion">[docs]</a>    <span class="k">def</span> <span class="nf">set_dispersion</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parameter</span><span class="p">,</span> <span class="n">dispersion</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the dispersion object for a model parameter</span>
+<span class="sd">        </span>
+<span class="sd">        :param parameter: name of the parameter [string]</span>
+<span class="sd">        :dispersion: dispersion object of type DispersionModel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">value</span><span class="o">=</span> <span class="bp">None</span>
+        <span class="n">new_pre</span> <span class="o">=</span> <span class="n">parameter</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;_&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">new_parameter</span> <span class="o">=</span> <span class="n">parameter</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;_&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">new_pre</span> <span class="o">==</span> <span class="s">&#39;p1&#39;</span> <span class="ow">and</span> \
+                            <span class="n">new_parameter</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">set_dispersion</span><span class="p">(</span><span class="n">new_parameter</span><span class="p">,</span> <span class="n">dispersion</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">new_pre</span> <span class="o">==</span> <span class="s">&#39;p2&#39;</span> <span class="ow">and</span> \
+                             <span class="n">new_parameter</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">set_dispersion</span><span class="p">(</span><span class="n">new_parameter</span><span class="p">,</span> <span class="n">dispersion</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_dispersion</span><span class="p">()</span>
+            <span class="k">return</span> <span class="n">value</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">raise</span> 
+</div>
+<div class="viewcode-block" id="Model.fill_description"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2.Model.fill_description">[docs]</a>    <span class="k">def</span> <span class="nf">fill_description</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">p_model1</span><span class="p">,</span> <span class="n">p_model2</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the description for P(Q)+P(Q)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">description</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">description</span> <span class="o">+=</span><span class="s">&quot;This model gives the summation of (A*</span><span class="si">%s</span><span class="s">) and ((1-A)*</span><span class="si">%s</span><span class="s">).</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> \
+                                        <span class="p">(</span> <span class="n">p_model1</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">p_model2</span><span class="o">.</span><span class="n">name</span> <span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">description</span> <span class="o">+=</span> <span class="n">description</span>
+    
+    <span class="c">## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       </span></div>
+<div class="viewcode-block" id="Model.get_fname"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_Ap1_1_Ap2.Model.get_fname">[docs]</a>    <span class="k">def</span> <span class="nf">get_fname</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the model name same as the file name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">_getframe</span><span class="p">()</span><span class="o">.</span><span class="n">f_code</span><span class="o">.</span><span class="n">co_filename</span>
+        <span class="n">basename</span>  <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">name</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">name</span>
+            
+<span class="c">### FOR TEST                </span></div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">m1</span><span class="o">=</span> <span class="n">Model</span><span class="p">()</span> 
+    <span class="n">out1</span> <span class="o">=</span> <span class="n">m1</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>
+    <span class="n">m2</span><span class="o">=</span> <span class="n">Model</span><span class="p">()</span>
+    <span class="n">out2</span> <span class="o">=</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="n">m2</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span> <span class="o">+</span> <span class="mf">0.5</span> <span class="o">*</span> <span class="n">m2</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>
+    <span class="k">print</span> <span class="s">&quot;Testing at Q = 0.01:&quot;</span>
+    <span class="k">print</span> <span class="n">out1</span><span class="p">,</span> <span class="s">&quot; = &quot;</span><span class="p">,</span> <span class="n">out2</span>
+    <span class="k">if</span> <span class="n">out1</span> <span class="o">==</span> <span class="n">out2</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Passed!&quot;</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Failed!&quot;</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/plugin_models/sum_p1_p2.html
===================================================================
--- _modules/sas/perspectives/fitting/plugin_models/sum_p1_p2.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/plugin_models/sum_p1_p2.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,532 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.plugin_models.sum_p1_p2 &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.plugin_models.sum_p1_p2</h1><div class="highlight"><pre>
+<span class="c"># A sample of an experimental model function for Sum(Pmodel1,Pmodel2)</span>
+<span class="kn">import</span> <span class="nn">copy</span>
+<span class="kn">from</span> <span class="nn">sas.models.pluginmodel</span> <span class="kn">import</span> <span class="n">Model1DPlugin</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">Please select the &#39;Compile&#39; from the menubar after the modification and saving.</span>
+<span class="sd">Note that we recommend to save the file as a different file name.</span>
+<span class="sd">Otherwise, it could be removed in the future on re-installation of the SasView.</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="c"># Available model names for this sum model</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">BCCrystalModel, BEPolyelectrolyte, BarBellModel, BinaryHSModel, BroadPeakModel,</span>
+<span class="sd">CSParallelepipedModel, CappedCylinderModel, CoreShellCylinderModel,</span>
+<span class="sd">CoreShellEllipsoidModel, CoreShellModel, CorrLengthModel, CylinderModel, </span>
+<span class="sd">DABModel, DebyeModel, EllipsoidModel, EllipticalCylinderModel, FCCrystalModel,</span>
+<span class="sd">FlexCylEllipXModel, FlexibleCylinderModel, FractalCoreShellModel, FractalModel,</span>
+<span class="sd">FuzzySphereModel, GaussLorentzGelModel, GuinierModel, GuinierPorodModel,</span>
+<span class="sd">HardsphereStructure, HayterMSAStructure, HollowCylinderModel, LamellarFFHGModel,</span>
+<span class="sd">LamellarModel, LamellarPCrystalModel, LamellarPSHGModel, LamellarPSModel,</span>
+<span class="sd">LineModel, LorentzModel, MultiShellModel, ParallelepipedModel, PeakGaussModel,</span>
+<span class="sd">PeakLorentzModel, PearlNecklaceModel, Poly_GaussCoil, PolymerExclVolume,</span>
+<span class="sd">PorodModel, PowerLawAbsModel, SCCrystalModel, SphereModel, SquareWellStructure,</span>
+<span class="sd">StackedDisksModel, StickyHSStructure, TeubnerStreyModel, TriaxialEllipsoidModel,</span>
+<span class="sd">TwoLorentzianModel, TwoPowerLawModel, VesicleModel</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c">## This is same as the Easy Custom Sum(p1 + p2) </span>
+<span class="c">#</span>
+<span class="c">#     Custom model = scale_factor * (P1 + P2)</span>
+<span class="c">#</span>
+<span class="c">## User can REPLACE model names below two arrowed lines (two names per line)</span>
+<span class="kn">from</span> <span class="nn">sas.models.CylinderModel</span> <span class="kn">import</span> <span class="n">CylinderModel</span> <span class="k">as</span> <span class="n">P1</span>          <span class="c">#&lt;========</span>
+<span class="kn">from</span> <span class="nn">sas.models.PolymerExclVolume</span> <span class="kn">import</span> <span class="n">PolymerExclVolume</span> <span class="k">as</span> <span class="n">P2</span>  <span class="c">#&lt;========</span>
+
+<span class="c"># If you want to add your custom model, change the filename to your custom model</span>
+<span class="c"># FILE NAME without the extension(.py). And un-comment the line(ie., remove &#39;#&#39;)</span>
+
+<span class="c"># from filename import Model as P2      #&lt;========</span>
+
+
+<span class="c">#####DO NOT CHANGE ANYTHING BELOW THIS LINE </span>
+<span class="c">#####---------------------------------------------------------------------------</span>
+<div class="viewcode-block" id="Model"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_p1_p2.Model">[docs]</a><span class="k">class</span> <span class="nc">Model</span><span class="p">(</span><span class="n">Model1DPlugin</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Use for p1(Q)+p2(Q); </span>
+<span class="sd">    Note: P(Q) refers to &#39;form factor&#39; model.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span> 
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="n">Model1DPlugin</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        :param p_model1: a form factor, P(Q)</span>
+<span class="sd">        :param p_model2: another form factor, P(Q)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">p_model1</span> <span class="o">=</span> <span class="n">P1</span><span class="p">()</span>
+        <span class="n">p_model2</span> <span class="o">=</span> <span class="n">P2</span><span class="p">()</span>
+        <span class="c">## Setting  model name model description</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">description</span><span class="o">=</span><span class="s">&quot;&quot;</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">description</span> <span class="o">=</span> <span class="n">p_model1</span><span class="o">.</span><span class="n">name</span><span class="o">+</span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">description</span> <span class="o">+=</span> <span class="n">p_model2</span><span class="o">.</span><span class="n">name</span><span class="o">+</span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fill_description</span><span class="p">(</span><span class="n">p_model1</span><span class="p">,</span> <span class="n">p_model2</span><span class="p">)</span>
+        <span class="c"># Set the name same as the file name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_fname</span><span class="p">()</span>     <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="c">## Define parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span> <span class="o">=</span> <span class="p">{}</span>
+
+        <span class="c">## Parameter details [units, min, max]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span> <span class="o">=</span> <span class="p">{}</span>
+        
+        <span class="c"># non-fittable parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">non_fittable</span> <span class="o">=</span> <span class="n">p_model1</span><span class="o">.</span><span class="n">non_fittable</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">non_fittable</span> <span class="o">+=</span> <span class="n">p_model2</span><span class="o">.</span><span class="n">non_fittable</span>  
+            
+        <span class="c">##models </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">=</span> <span class="n">p_model1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">=</span> <span class="n">p_model2</span>
+        
+       
+        <span class="c">## dispersion</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_dispersion</span><span class="p">()</span>
+        <span class="c">## Define parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_params</span><span class="p">()</span>
+        <span class="c">## New parameter:Scaling factor</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span>
+        
+        <span class="c">## Parameter details [units, min, max]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_details</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;&#39;</span><span class="p">,</span>  <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>
+        <span class="c">## Magnetic Panrameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_params</span> <span class="o">=</span> <span class="p">[]</span>
+        
+        <span class="c">#list of parameter that can be fitted</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_fixed_params</span><span class="p">()</span>  
+        <span class="c">## parameters with orientation</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p1_&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">new_item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+            
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p2_&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">new_item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">orientation_params</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+        <span class="c">## magnetic params</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p1_&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">new_item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_params</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+            
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p2_&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">new_item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_params</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">magnetic_params</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+        <span class="c"># set multiplicity 1: muti_func Not supported.</span>
+        <span class="n">multiplicity1</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="n">multiplicity2</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="c">## functional multiplicity of the model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplicity1</span> <span class="o">=</span> <span class="n">multiplicity1</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplicity2</span> <span class="o">=</span> <span class="n">multiplicity2</span>    
+        <span class="bp">self</span><span class="o">.</span><span class="n">multiplicity_info</span> <span class="o">=</span> <span class="p">[]</span>   
+        
+    <span class="k">def</span> <span class="nf">_clone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Internal utility function to copy the internal</span>
+<span class="sd">            data members to a fresh copy.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">params</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="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">description</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="bp">self</span><span class="o">.</span><span class="n">description</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">details</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="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">dispersion</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="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">)</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">p_model1</span>  <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="n">obj</span><span class="o">.</span><span class="n">p_model2</span>  <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="c">#obj = copy.deepcopy(self)</span>
+        <span class="k">return</span> <span class="n">obj</span>
+    
+    <span class="k">def</span> <span class="nf">_get_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name1</span><span class="p">,</span> <span class="n">name2</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get combined name from two model names</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">p1_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_upper_name</span><span class="p">(</span><span class="n">name1</span><span class="p">)</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">p1_name</span><span class="p">:</span>
+            <span class="n">p1_name</span> <span class="o">=</span> <span class="n">name1</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="n">p1_name</span>
+        <span class="n">name</span> <span class="o">+=</span> <span class="s">&quot;+&quot;</span>
+        <span class="n">p2_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_upper_name</span><span class="p">(</span><span class="n">name2</span><span class="p">)</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">p2_name</span><span class="p">:</span>
+            <span class="n">p2_name</span> <span class="o">=</span> <span class="n">name2</span>
+        <span class="n">name</span> <span class="o">+=</span> <span class="n">p2_name</span>
+        <span class="k">return</span> <span class="n">name</span>
+    
+    <span class="k">def</span> <span class="nf">_get_upper_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get uppercase string from model name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> <span class="s">&quot;&quot;</span>
+        <span class="n">upper_name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">str_name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">index</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">str_name</span><span class="p">)):</span>
+            <span class="k">if</span> <span class="n">str_name</span><span class="p">[</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">isupper</span><span class="p">():</span>
+                <span class="n">upper_name</span> <span class="o">+=</span> <span class="n">str_name</span><span class="p">[</span><span class="n">index</span><span class="p">]</span>
+        <span class="k">return</span> <span class="n">upper_name</span>
+        
+    <span class="k">def</span> <span class="nf">_set_dispersion</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">           combined the two models dispersions</span>
+<span class="sd">           Polydispersion should not be applied to s_model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">##set dispersion only from p_model </span>
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c">#if name.lower() not in self.p_model1.orientation_params:</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p1_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">value</span> 
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c">#if name.lower() not in self.p_model2.orientation_params:</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p2_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">value</span> 
+            
+<div class="viewcode-block" id="Model.function"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_p1_p2.Model.function">[docs]</a>    <span class="k">def</span> <span class="nf">function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="o">=</span><span class="mf">0.0</span><span class="p">):</span> 
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="mi">0</span>
+                               </div>
+<div class="viewcode-block" id="Model.getProfile"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_p1_p2.Model.getProfile">[docs]</a>    <span class="k">def</span> <span class="nf">getProfile</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get SLD profile of p_model if exists</span>
+<span class="sd">        </span>
+<span class="sd">        : return: (r, beta) where r is a list of radius of the transition points</span>
+<span class="sd">                beta is a list of the corresponding SLD values </span>
+<span class="sd">        : Note: This works only for func_shell# = 2 (exp function)</span>
+<span class="sd">                and is not supporting for p2</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">x</span><span class="p">,</span><span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">getProfile</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">x</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">y</span> <span class="o">=</span> <span class="bp">None</span>
+            
+        <span class="k">return</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span>
+    </div>
+    <span class="k">def</span> <span class="nf">_set_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Concatenate the parameters of the two models to create</span>
+<span class="sd">            this model parameters </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c"># No 2D-supported</span>
+            <span class="c">#if name not in self.p_model1.orientation_params:</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p1_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">value</span>
+            
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c"># No 2D-supported</span>
+            <span class="c">#if name not in self.p_model2.orientation_params:</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p2_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">value</span>
+                
+        <span class="c"># Set &quot;scale&quot; as initializing</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_scale_factor</span><span class="p">()</span>
+      
+            
+    <span class="k">def</span> <span class="nf">_set_details</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Concatenate details of the two models to create</span>
+<span class="sd">            this model details </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span><span class="n">detail</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">details</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p1_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="c">#if new_name not in self.orientation_params:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">detail</span>
+            
+        <span class="k">for</span> <span class="n">name</span> <span class="p">,</span><span class="n">detail</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">details</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">new_name</span> <span class="o">=</span> <span class="s">&quot;p2_&quot;</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="c">#if new_name not in self.orientation_params:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span><span class="o">=</span> <span class="n">detail</span>
+    
+    <span class="k">def</span> <span class="nf">_set_scale_factor</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Not implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">pass</span>
+        
+                
+<div class="viewcode-block" id="Model.setParam"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_p1_p2.Model.setParam">[docs]</a>    <span class="k">def</span> <span class="nf">setParam</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Set the value of a model parameter</span>
+<span class="sd">    </span>
+<span class="sd">        :param name: name of the parameter</span>
+<span class="sd">        :param value: value of the parameter</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># set param to p1+p2 model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_setParamHelper</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+        
+        <span class="c">## setParam to p model </span>
+        <span class="n">model_pre</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;_&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">new_name</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;_&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">model_pre</span> <span class="o">==</span> <span class="s">&quot;p1&quot;</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">new_name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">getParamList</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">new_name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">model_pre</span> <span class="o">==</span> <span class="s">&quot;p2&quot;</span><span class="p">:</span>
+             <span class="k">if</span> <span class="n">new_name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">getParamList</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">setParam</span><span class="p">(</span><span class="n">new_name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;scale_factor&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;Model does not contain parameter </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">name</span>
+            </div>
+<div class="viewcode-block" id="Model.getParam"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_p1_p2.Model.getParam">[docs]</a>    <span class="k">def</span> <span class="nf">getParam</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Set the value of a model parameter</span>
+
+<span class="sd">        :param name: name of the parameter</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Look for dispersion parameters</span>
+        <span class="n">toks</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">toks</span><span class="p">)</span><span class="o">==</span><span class="mi">2</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="c"># 2D not supported</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">==</span><span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span><span class="c"># and \</span>
+                            <span class="c">#item.lower() not in self.orientation_params \</span>
+                            <span class="c">#and toks[0].lower() not in self.orientation_params:</span>
+                    <span class="k">for</span> <span class="n">par</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">item</span><span class="p">]:</span>
+                        <span class="k">if</span> <span class="n">par</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="n">toks</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span>
+                            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">par</span><span class="p">]</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># Look for standard parameter</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">==</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span><span class="c">#and \</span>
+                            <span class="c">#item.lower() not in self.orientation_params \</span>
+                            <span class="c">#and toks[0].lower() not in self.orientation_params:</span>
+                    <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="n">item</span><span class="p">]</span>
+        <span class="k">return</span>  
+        <span class="c">#raise ValueError, &quot;Model does not contain parameter %s&quot; % name</span>
+       </div>
+    <span class="k">def</span> <span class="nf">_setParamHelper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Helper function to setparam</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Look for dispersion parameters</span>
+        <span class="n">toks</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">toks</span><span class="p">)</span><span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">==</span> <span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span><span class="c"># and \</span>
+                            <span class="c">#item.lower() not in self.orientation_params:</span>
+                    <span class="k">for</span> <span class="n">par</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">item</span><span class="p">]:</span>
+                        <span class="k">if</span> <span class="n">par</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="n">toks</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span><span class="c">#and \</span>
+                                <span class="c">#item.lower() not in self.orientation_params:</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">dispersion</span><span class="p">[</span><span class="n">item</span><span class="p">][</span><span class="n">par</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
+                            <span class="k">return</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># Look for standard parameter</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="o">==</span> <span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">():</span><span class="c">#and \</span>
+                            <span class="c">#item.lower() not in self.orientation_params:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
+                    <span class="k">return</span>
+            
+        <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;Model does not contain parameter </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">name</span>
+             
+   
+    <span class="k">def</span> <span class="nf">_set_fixed_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">             fill the self.fixed list with the p_model fixed list</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">fixed</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p1&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fixed</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">fixed</span><span class="p">:</span>
+            <span class="n">new_item</span> <span class="o">=</span> <span class="s">&quot;p2&quot;</span> <span class="o">+</span> <span class="n">item</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fixed</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_item</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">fixed</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
+                
+                    
+<div class="viewcode-block" id="Model.run"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_p1_p2.Model.run">[docs]</a>    <span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Evaluate the model</span>
+<span class="sd">        </span>
+<span class="sd">        :param x: input q-value (float or [float, float] as [r, theta])</span>
+<span class="sd">        :return: (scattering function value)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_scale_factor</span><span class="p">()</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">*</span> \
+                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+    </div>
+<div class="viewcode-block" id="Model.runXY"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_p1_p2.Model.runXY">[docs]</a>    <span class="k">def</span> <span class="nf">runXY</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Evaluate the model</span>
+<span class="sd">        </span>
+<span class="sd">        :param x: input q-value (float or [float, float] as [qx, qy])</span>
+<span class="sd">        :return: scattering function value</span>
+<span class="sd">        &quot;&quot;&quot;</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_scale_factor</span><span class="p">()</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">*</span> \
+                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+    
+    <span class="c">## Now (May27,10) directly uses the model eval function </span>
+    <span class="c">## instead of the for-loop in Base Component.</span></div>
+<div class="viewcode-block" id="Model.evalDistribution"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_p1_p2.Model.evalDistribution">[docs]</a>    <span class="k">def</span> <span class="nf">evalDistribution</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="p">[]):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Evaluate the model in cartesian coordinates</span>
+<span class="sd">        </span>
+<span class="sd">        :param x: input q[], or [qx[], qy[]]</span>
+<span class="sd">        :return: scattering function P(q[])</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_scale_factor</span><span class="p">()</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale_factor&#39;</span><span class="p">]</span> <span class="o">*</span> \
+                    <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">evalDistribution</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> \
+                                 <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">evalDistribution</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+</div>
+<div class="viewcode-block" id="Model.set_dispersion"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_p1_p2.Model.set_dispersion">[docs]</a>    <span class="k">def</span> <span class="nf">set_dispersion</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parameter</span><span class="p">,</span> <span class="n">dispersion</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the dispersion object for a model parameter</span>
+<span class="sd">        </span>
+<span class="sd">        :param parameter: name of the parameter [string]</span>
+<span class="sd">        :dispersion: dispersion object of type DispersionModel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">value</span><span class="o">=</span> <span class="bp">None</span>
+        <span class="n">new_pre</span> <span class="o">=</span> <span class="n">parameter</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;_&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">new_parameter</span> <span class="o">=</span> <span class="n">parameter</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;_&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">new_pre</span> <span class="o">==</span> <span class="s">&#39;p1&#39;</span> <span class="ow">and</span> \
+                            <span class="n">new_parameter</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">set_dispersion</span><span class="p">(</span><span class="n">new_parameter</span><span class="p">,</span> <span class="n">dispersion</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">new_pre</span> <span class="o">==</span> <span class="s">&#39;p2&#39;</span> <span class="ow">and</span> \
+                             <span class="n">new_parameter</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">dispersion</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                <span class="n">value</span><span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">set_dispersion</span><span class="p">(</span><span class="n">new_parameter</span><span class="p">,</span> <span class="n">dispersion</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_dispersion</span><span class="p">()</span>
+            <span class="k">return</span> <span class="n">value</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">raise</span> 
+</div>
+<div class="viewcode-block" id="Model.fill_description"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_p1_p2.Model.fill_description">[docs]</a>    <span class="k">def</span> <span class="nf">fill_description</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">p_model1</span><span class="p">,</span> <span class="n">p_model2</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill the description for P(Q)+P(Q)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">description</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">description</span> <span class="o">+=</span><span class="s">&quot;This model gives the summation of  </span><span class="si">%s</span><span class="s"> and </span><span class="si">%s</span><span class="s">.</span><span class="se">\n</span><span class="s">&quot;</span><span class="o">%</span> \
+                                        <span class="p">(</span> <span class="n">p_model1</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">p_model2</span><span class="o">.</span><span class="n">name</span> <span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">description</span> <span class="o">+=</span> <span class="n">description</span>
+    
+    <span class="c">## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       </span></div>
+<div class="viewcode-block" id="Model.get_fname"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.sum_p1_p2.Model.get_fname">[docs]</a>    <span class="k">def</span> <span class="nf">get_fname</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the model name same as the file name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">_getframe</span><span class="p">()</span><span class="o">.</span><span class="n">f_code</span><span class="o">.</span><span class="n">co_filename</span>
+        <span class="n">basename</span>  <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">name</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">name</span>
+            </div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">m1</span><span class="o">=</span> <span class="n">Model</span><span class="p">()</span> 
+    <span class="c">#m1.setParam(&quot;p1_scale&quot;, 25)  </span>
+    <span class="c">#m1.setParam(&quot;p1_length&quot;, 1000)</span>
+    <span class="c">#m1.setParam(&quot;p2_scale&quot;, 100) </span>
+    <span class="c">#m1.setParam(&quot;p2_rg&quot;, 100) </span>
+    <span class="n">out1</span> <span class="o">=</span> <span class="n">m1</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>
+
+    <span class="n">m2</span><span class="o">=</span> <span class="n">Model</span><span class="p">()</span>
+    <span class="c">#m2.p_model1.setParam(&quot;scale&quot;, 25) </span>
+    <span class="c">#m2.p_model1.setParam(&quot;length&quot;, 1000) </span>
+    <span class="c">#m2.p_model2.setParam(&quot;scale&quot;, 100)</span>
+    <span class="c">#m2.p_model2.setParam(&quot;rg&quot;, 100)</span>
+    <span class="n">out2</span> <span class="o">=</span> <span class="n">m2</span><span class="o">.</span><span class="n">p_model1</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span> <span class="o">+</span> <span class="n">m2</span><span class="o">.</span><span class="n">p_model2</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>
+    <span class="k">print</span> <span class="s">&quot;Testing at Q = 0.01:&quot;</span>
+    <span class="k">print</span> <span class="n">out1</span><span class="p">,</span> <span class="s">&quot; = &quot;</span><span class="p">,</span> <span class="n">out2</span>
+    <span class="k">if</span> <span class="n">out1</span> <span class="o">==</span> <span class="n">out2</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Passed!&quot;</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Failed!&quot;</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/plugin_models/testmodel.html
===================================================================
--- _modules/sas/perspectives/fitting/plugin_models/testmodel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/plugin_models/testmodel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,207 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.plugin_models.testmodel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.plugin_models.testmodel</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Test plug-in model</span>
+<span class="sd">These are links of available functions:</span>
+
+<span class="sd">http://docs.python.org/library/math.html</span>
+<span class="sd">http://www.scipy.org/Numpy_Functions_by_Category</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">Please select the &#39;Compile&#39; from the menubar after the modification and saving.</span>
+<span class="sd">Note that we recommend to save the file as a different file name.</span>
+<span class="sd">Otherwise, it could be removed in the future on re-installation of the SasView.</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">from</span> <span class="nn">sas.models.pluginmodel</span> <span class="kn">import</span> <span class="n">Model1DPlugin</span>  <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+<span class="kn">import</span> <span class="nn">math</span>                  <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+<span class="kn">import</span> <span class="nn">numpy</span>               <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="c">##PLEASE READ COMMENTS CAREFULLY !!! COMMENT ARE IN CAPITAL LETTERS AND AFTER ##</span>
+<span class="c">## THESE COMMENTS ARE THERE TO GUIDE YOU. YOU CAN REMOVE THEM ONLY WHEN YOU ARE</span>
+<span class="c">## CONFORTABLE ENOUGH WITH OUR MODEL PLUGIN OPTION</span>
+
+
+<span class="c">## &lt;-----  SIGN DEFINES WHERE YOU CAN MODIFY THE CODE</span>
+
+<div class="viewcode-block" id="Model"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.testmodel.Model">[docs]</a><span class="k">class</span> <span class="nc">Model</span><span class="p">(</span><span class="n">Model1DPlugin</span><span class="p">):</span><span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    ##YOU CAN BE MODIFY ANYTHING BETWEEN &quot;&quot;&quot;</span> <span class="s">&quot;&quot;&quot;</span>
+<span class="s">    ##DESCRIPTION OF MODEL PLUG-IN GOES HERE</span>
+<span class="s">    </span>
+<span class="s">    ##EXAMPLE:Class that evaluates a cos(x) model. </span>
+<span class="s">    &quot;&quot;&quot;</span>
+    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>     
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialization</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">Model1DPlugin</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span><span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        
+        <span class="c">## EDIT PARAMETERS&#39; NAMES AND VALUE</span>
+        <span class="c">## DELETE MODIFIABLE LINE HERE WILL REDUCE THE NUMBER OF PARAMETERS</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span> <span class="o">=</span> <span class="p">{}</span>                        <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="c"># Set the name same as the file name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_fname</span><span class="p">()</span>     <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>       <span class="c">## &lt;-----  </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE   </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;B&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>       <span class="c">## &lt;----- </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE    </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;C&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">10.0</span>      <span class="c">## &lt;-----  </span>
+
+        <span class="c">## DEFINE DEFAULT DETAILS</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_details</span><span class="p">()</span>      <span class="c">##DO NOT DELETE OR CHANGE THIS LINE!!!</span>
+        
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.MODIFY WORDS BETWEEN &quot;&quot;&quot;   &quot;&quot;&quot;  ONLY!!!!</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">description</span> <span class="o">=</span> <span class="s">&quot;F(x)=A+Bcos(2x)+Csin(2x) &quot;</span>     <span class="c">## &lt;----- </span>
+   
+<div class="viewcode-block" id="Model.function"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.testmodel.Model.function">[docs]</a>    <span class="k">def</span> <span class="nf">function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">):</span>  <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Evaluate the model</span>
+<span class="sd">        </span>
+<span class="sd">        :param x: input x</span>
+<span class="sd">        </span>
+<span class="sd">        :return: function value</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## ADD YOUR FUNCTION HERE.</span>
+        <span class="c">## REUSE THE PARAMETERS DEFINED PREVIOUSLY TO WRITE YOUR FUNCTION.</span>
+        
+        <span class="c">## IN THIS EXAMPLE THE FUNTION IS:</span>
+        <span class="c">## A+Bcos(2x)+Csin(2x)</span>
+        <span class="c">## YOU CAN USE math.sin or sin directly</span>
+        <span class="c">## NOTE: sin, cos ARE FUNCTIONS  IMPORTED FROM PYTHON MATH LIBRARY</span>
+        <span class="c">## FOR MORE INFORMATION CHECK http://docs.python.org/library/math.html      </span>
+        <span class="c">## OTHER FUNCTIONS ARE ALSO </span>
+        <span class="c">##  AVAILABLE http://www.scipy.org/Numpy_Functions_by_Category</span>
+        <span class="c">## numpy FUNCTIONS ARE FOR EXPERT USER</span>
+        
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;B&#39;</span><span class="p">]</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">cos</span><span class="p">(</span><span class="mf">2.0</span><span class="o">*</span><span class="n">x</span><span class="p">)</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;C&#39;</span><span class="p">]</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="mf">2.0</span><span class="o">*</span><span class="n">x</span><span class="p">)</span>
+    
+    <span class="c">## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!   </span></div>
+<div class="viewcode-block" id="Model.get_fname"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.testmodel.Model.get_fname">[docs]</a>    <span class="k">def</span> <span class="nf">get_fname</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the model name same as the file name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">_getframe</span><span class="p">()</span><span class="o">.</span><span class="n">f_code</span><span class="o">.</span><span class="n">co_filename</span>
+        <span class="n">basename</span>  <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">name</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">name</span>
+    
+<span class="c">## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       </span></div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">m</span><span class="o">=</span> <span class="n">Model</span><span class="p">()</span> 
+    <span class="n">out1</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.0</span><span class="p">)</span>
+    <span class="n">out2</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>
+    <span class="n">isfine1</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">out1</span><span class="p">)</span>
+    <span class="n">isfine2</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">out2</span><span class="p">)</span>
+    <span class="k">print</span> <span class="s">&quot;Testing the value at Q = 0.0:&quot;</span>
+    <span class="k">print</span> <span class="n">out1</span><span class="p">,</span> <span class="s">&quot; : finite? &quot;</span><span class="p">,</span> <span class="n">isfine1</span>
+    <span class="k">print</span> <span class="s">&quot;Testing the value at Q = 0.01:&quot;</span>
+    <span class="k">print</span> <span class="n">out2</span><span class="p">,</span> <span class="s">&quot; : finite? &quot;</span><span class="p">,</span> <span class="n">isfine2</span>
+    <span class="k">if</span> <span class="n">isfine1</span> <span class="ow">and</span> <span class="n">isfine2</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Passed!&quot;</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Failed!&quot;</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/plugin_models/testmodel_2.html
===================================================================
--- _modules/sas/perspectives/fitting/plugin_models/testmodel_2.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/plugin_models/testmodel_2.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,270 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.plugin_models.testmodel_2 &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.plugin_models.testmodel_2</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Test plug-in model</span>
+<span class="sd">These are links of available functions:</span>
+
+<span class="sd">http://docs.python.org/library/math.html</span>
+<span class="sd">http://www.scipy.org/Numpy_Functions_by_Category</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">Please select the &#39;Compile&#39; from the menubar after the modification and saving.</span>
+<span class="sd">Note that we recommend to save the file as a different file name.</span>
+<span class="sd">Otherwise, it could be removed in the future on re-installation of the SasView.</span>
+<span class="sd">## *****************************************************************************</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">from</span> <span class="nn">sas.models.pluginmodel</span> <span class="kn">import</span> <span class="n">Model1DPlugin</span>  <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+<span class="kn">import</span> <span class="nn">math</span>                     <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+<span class="kn">import</span> <span class="nn">numpy</span>                    <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="c">##PLEASE READ COMMENTS CAREFULLY !!! COMMENT ARE IN CAPITAL LETTERS AND AFTER ##</span>
+<span class="c">## THESE COMMENTS ARE THERE TO GUIDE YOU. YOU CAN REMOVE THEM ONLY WHEN YOU ARE</span>
+<span class="c">## CONFORTABLE ENOUGH WITH OUR MODEL PLUGIN OPTION</span>
+
+
+<span class="c">## &lt;-----  SIGN DEFINES WHERE YOU CAN MODIFY THE CODE</span>
+
+<div class="viewcode-block" id="Model"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.testmodel_2.Model">[docs]</a><span class="k">class</span> <span class="nc">Model</span><span class="p">(</span><span class="n">Model1DPlugin</span><span class="p">):</span> <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    ##YOU CAN BE MODIFY ANYTHING BETWEEN &quot;&quot;&quot;</span> <span class="s">&quot;&quot;&quot;</span>
+<span class="s">    ##DESCRIPTION OF MODEL PLUG-IN GOES HERE</span>
+<span class="s">    </span>
+<span class="s">    ##EXAMPLE: Class that evaluates a polynomial model. </span>
+<span class="s">    &quot;&quot;&quot;</span>
+    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span> 
+                                
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>      <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialization</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">Model1DPlugin</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        
+        <span class="c">## EDIT PARAMETERS&#39; NAMES AND VALUE</span>
+        <span class="c">## DELETE MODIFIABLE LINE HERE WILL REDUCE THE NUMBER OF PARAMETERS</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span> <span class="o">=</span> <span class="p">{}</span>                <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="c"># Set the name same as the file name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_fname</span><span class="p">()</span>     <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>   <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE                                                      </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>       <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE                 </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;B&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">10.0</span>      <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE                  </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;C&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>       <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE                </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;D&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>     <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE                   </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;E&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>     <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THELINE BELLOW.CHANGE WORD BETWEEN &#39; &#39; AND NUMBER </span>
+        <span class="c">## YOU CAN ALSO DELETE THIS LINE                  </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;F&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.0</span>     <span class="c">## &lt;-----          </span>
+
+        <span class="c">## STORING PARAMETERS  [UNIT, MINIMUM VALUE, MAXIMUM VALUE]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span> <span class="o">=</span> <span class="p">{}</span>    <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39;,WORD BETWEEN</span>
+        <span class="c">## &#39; &#39;, TWO OTHER NUMBESR TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE      </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="s">&#39;scale&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;&#39;</span><span class="p">,</span><span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>    <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39;,WORD BETWEEN</span>
+        <span class="c">## &#39; &#39;, TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>        <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39;,WORD BETWEEN</span>
+        <span class="c">## &#39; &#39;, TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="s">&#39;B&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>        <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39;,WORD BETWEEN</span>
+        <span class="c">## &#39; &#39;, TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="s">&#39;C&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>        <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39;,WORD BETWEEN</span>
+        <span class="c">## &#39; &#39;, TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="s">&#39;D&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>        <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39;,WORD BETWEEN</span>
+        <span class="c">## &#39; &#39;, TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="s">&#39;E&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span>        <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.CHANGE WORD BETWEEN &#39; &#39;,WORD BETWEEN</span>
+        <span class="c">## &#39; &#39;, TWO OTHER NUMBERS TO NEW VALUE OR YOU CAN ALSO DELETE TH LINE     </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">details</span><span class="p">[</span><span class="s">&#39;F&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mf">1e16</span><span class="p">]</span>           <span class="c">## &lt;-----   </span>
+        <span class="c">## YOU CAN MODIFY THE LINE BELLOW.MODIFY WORDS BETWEEN &quot;&quot;&quot;   &quot;&quot;&quot;  ONLY!!!!</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">description</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;</span>
+<span class="s">            scale * sin(F(x)/F(x)) </span><span class="se">\n</span><span class="s"> where F(x)=A+B*x+C*x^2+D*x^3+E*x^4+F*x^5</span>
+<span class="s">                 &quot;&quot;&quot;</span>                        <span class="c">## &lt;-----   </span>
+   
+<div class="viewcode-block" id="Model.function"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.testmodel_2.Model.function">[docs]</a>    <span class="k">def</span> <span class="nf">function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="mf">0.0</span><span class="p">):</span> <span class="c">##DO NOT CHANGE THIS LINE!!!</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Evaluate the model</span>
+<span class="sd">        </span>
+<span class="sd">        :param x: input x</span>
+<span class="sd">        </span>
+<span class="sd">        :return: function value</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## ADD YOUR FUNCTION HERE.</span>
+        <span class="c">## REUSE THE PARAMETERS DEFINED PREVIOUSLY TO WRITE YOUR FUNCTION.</span>
+        
+        <span class="c">## IN THIS EXAMPLE THE FUNTION IS:</span>
+        <span class="c">## scale * sin(F(x)/F(x)) \n where F(x)=A+B*x+C*x^2+D*x^3+E*x^4+F*x^5</span>
+        
+        <span class="c">## YOU CAN REWRITE OUR EXAMPLE WITH EVERYTING INSIDE &quot; &quot; :</span>
+        <span class="c">## &quot;RETURN self.params[&#39;scale&#39;]* (self.params[&#39;A&#39;] + self.params[&#39;B&#39;]*x + \</span>
+        <span class="c">##   self.params[&#39;C&#39;]* pow(x,2) + self.params[&#39;D&#39;]*pow(x,3)+\</span>
+        <span class="c">## self.params[&#39;E&#39;]*pow(x,4) +self.params[&#39;F&#39;]*pow(x,5)  ) &quot;  </span>
+         
+        <span class="c">## NOTE: pow IS A FUNCTION IMPORTED FROM PYTHON MATH LIBRARY</span>
+        <span class="c">## FOR MORE INFORMATION CHECK http://docs.python.org/library/math.html      </span>
+        <span class="c">## OTHER FUNCTIONS ARE ALSO </span>
+        <span class="c">###  AVAILABLE http://www.scipy.org/Numpy_Functions_by_Category</span>
+        <span class="c">## numpy FUNCTIONS ARE FOR EXPERT USER</span>
+        
+         
+        <span class="c">## YOU CAN ERASE EVERYTHING BELLOW FOR YOUR OWN FUNCTION</span>
+        <span class="c">#Redefine parameters as local parameters</span>
+        <span class="n">a</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;A&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">b</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;B&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">c</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;C&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">d</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;D&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">e</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;E&#39;</span><span class="p">]</span>       <span class="c">## &lt;-----   </span>
+        <span class="n">f</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;F&#39;</span><span class="p">]</span>        <span class="c">## &lt;-----   </span>
+        <span class="n">scl</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;scale&#39;</span><span class="p">]</span>   <span class="c">## &lt;-----   </span>
+        <span class="c">##THIS OUR FUNCTION TEMPLATE</span>
+        <span class="n">poly</span> <span class="o">=</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span><span class="o">*</span><span class="n">x</span> <span class="o">+</span> <span class="n">c</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">pow</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="n">d</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">pow</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span> \
+             <span class="o">+</span> <span class="n">e</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">pow</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="mi">4</span><span class="p">)</span> <span class="o">+</span><span class="n">f</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">pow</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>      <span class="c">## &lt;-----                </span>
+        
+        <span class="c">#Remove a singular point (lim poly --&gt; 0) for sin(poly)/poly</span>
+        <span class="c">#(Just note: In Python, indentation defines the belongings of &#39;if&#39;, &#39;for&#39;, and so on..)</span>
+        <span class="k">if</span> <span class="n">poly</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>                       <span class="c">## &lt;-----   </span>
+            <span class="n">result</span> <span class="o">=</span> <span class="mi">1</span>                      <span class="c">## &lt;-----   </span>
+        <span class="k">else</span><span class="p">:</span>                               <span class="c">## &lt;-----   </span>
+            <span class="n">result</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="n">poly</span><span class="p">)</span><span class="o">/</span><span class="n">poly</span>    <span class="c">## &lt;-----   </span>
+            
+        <span class="c">#Re-scale                          ## &lt;-----   </span>
+        <span class="n">result</span> <span class="o">*=</span><span class="n">scl</span>                       <span class="c">## &lt;-----   </span>
+
+        <span class="k">return</span> <span class="n">result</span> <span class="c">## MODIFY ONLY RESULT. DON&#39;T DELETE RETURN!!!!</span>
+
+    <span class="c">## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!   </span></div>
+<div class="viewcode-block" id="Model.get_fname"><a class="viewcode-back" href="../../../../../dev/api/sas.perspectives.fitting.plugin_models.html#sas.perspectives.fitting.plugin_models.testmodel_2.Model.get_fname">[docs]</a>    <span class="k">def</span> <span class="nf">get_fname</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the model name same as the file name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">_getframe</span><span class="p">()</span><span class="o">.</span><span class="n">f_code</span><span class="o">.</span><span class="n">co_filename</span>
+        <span class="n">basename</span>  <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">name</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">name</span>
+                
+<span class="c">## DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!!       </span></div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">m</span><span class="o">=</span> <span class="n">Model</span><span class="p">()</span> 
+    <span class="n">out1</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.0</span><span class="p">)</span>
+    <span class="n">out2</span> <span class="o">=</span> <span class="n">m</span><span class="o">.</span><span class="n">runXY</span><span class="p">(</span><span class="mf">0.01</span><span class="p">)</span>
+    <span class="n">isfine1</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">out1</span><span class="p">)</span>
+    <span class="n">isfine2</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">isfinite</span><span class="p">(</span><span class="n">out2</span><span class="p">)</span>
+    <span class="k">print</span> <span class="s">&quot;Testing the value at Q = 0.0:&quot;</span>
+    <span class="k">print</span> <span class="n">out1</span><span class="p">,</span> <span class="s">&quot; : finite? &quot;</span><span class="p">,</span> <span class="n">isfine1</span>
+    <span class="k">print</span> <span class="s">&quot;Testing the value at Q = 0.01:&quot;</span>
+    <span class="k">print</span> <span class="n">out2</span><span class="p">,</span> <span class="s">&quot; : finite? &quot;</span><span class="p">,</span> <span class="n">isfine2</span>
+    <span class="k">if</span> <span class="n">isfine1</span> <span class="ow">and</span> <span class="n">isfine2</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Passed!&quot;</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">print</span> <span class="s">&quot;===&gt; Simple Test: Failed!&quot;</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/report_dialog.html
===================================================================
--- _modules/sas/perspectives/fitting/report_dialog.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/report_dialog.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,407 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.report_dialog &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.report_dialog</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Dialog report panel to show and summarize the results of </span>
+<span class="sd">the invariant calculation.</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation.</span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">wx.html</span> <span class="kn">as</span> <span class="nn">html</span>
+
+<span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">480</span>
+<span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">530</span>
+<span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">700</span>
+<span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+<span class="n">ISMAC</span> <span class="o">=</span> <span class="bp">False</span>
+<span class="n">ISPDF</span> <span class="o">=</span> <span class="bp">False</span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span> <span class="o">==</span> <span class="s">&quot;win32&quot;</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">450</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">700</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+    <span class="n">ISMAC</span> <span class="o">=</span> <span class="bp">False</span>
+    <span class="n">ISPDF</span> <span class="o">=</span> <span class="bp">True</span>
+<span class="k">elif</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span> <span class="o">==</span> <span class="s">&quot;darwin&quot;</span><span class="p">:</span>
+    <span class="n">ISMAC</span> <span class="o">=</span> <span class="bp">True</span>
+    <span class="n">ISPDF</span> <span class="o">=</span> <span class="bp">True</span>
+
+        
+<div class="viewcode-block" id="ReportDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.report_dialog.ReportDialog">[docs]</a><span class="k">class</span> <span class="nc">ReportDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    The report dialog box.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">list</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialization. The parameters added to Dialog are:</span>
+<span class="sd">        </span>
+<span class="sd">        :param list: report_list (list of html_str, text_str, image)</span>
+<span class="sd">        from invariant_state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;style&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RESIZE_BORDER</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">DEFAULT_DIALOG_STYLE</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;image&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;Dynamic Image&#39;</span>
+        <span class="c"># title</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="s">&quot;Report: Fitting&quot;</span><span class="p">)</span>
+        <span class="c"># size</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSize</span><span class="p">((</span><span class="mi">720</span><span class="p">,</span> <span class="mi">650</span><span class="p">))</span>
+        <span class="c"># font size</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="c"># check if tit is MAC</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_pdf</span> <span class="o">=</span> <span class="n">ISPDF</span>
+        <span class="c"># report string</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span> <span class="o">=</span> <span class="nb">list</span>
+        <span class="c"># number of images of plot</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nimages</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
+        
+        <span class="k">if</span> <span class="nb">list</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="c"># put image path in the report string</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">report_html</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">%</span> \
+                                    <span class="s">&quot;memory:img_fit0.png&quot;</span>
+            <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">report_html</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">%</span> \
+                                    <span class="p">(</span><span class="s">&quot;memory:img_fit0.png&quot;</span><span class="p">,</span>
+                                     <span class="s">&quot;memory:img_fit1.png&quot;</span><span class="p">)</span>
+            <span class="c"># allows up to three images</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">report_html</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">%</span> \
+                                    <span class="p">(</span><span class="s">&quot;memory:img_fit0.png&quot;</span><span class="p">,</span>
+                                     <span class="s">&quot;memory:img_fit1.png&quot;</span><span class="p">,</span>
+                                     <span class="s">&quot;memory:img_fit2.png&quot;</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">report_html</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="c"># layout</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_setup_layout</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_setup_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set up layout</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">hbox</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>
+        
+        <span class="c"># buttons</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span>
+        <span class="n">button_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Close&quot;</span><span class="p">)</span>
+        <span class="n">button_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close this report window.&quot;</span><span class="p">)</span>
+        <span class="c">#hbox.Add((5,10), 1 , wx.EXPAND|wx.ADJUST_MINSIZE,0)</span>
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_close</span><span class="p">)</span>
+        <span class="n">button_close</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">button_preview</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Preview&quot;</span><span class="p">)</span>
+        <span class="n">button_preview</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Print preview this report.&quot;</span><span class="p">)</span>
+        <span class="n">button_preview</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onPreview</span><span class="p">,</span>
+                            <span class="nb">id</span><span class="o">=</span><span class="n">button_preview</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span> 
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_preview</span><span class="p">)</span>
+
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">button_print</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Print&quot;</span><span class="p">)</span>
+        <span class="n">button_print</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Print this report.&quot;</span><span class="p">)</span>
+        <span class="n">button_print</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onPrint</span><span class="p">,</span>
+                          <span class="nb">id</span><span class="o">=</span><span class="n">button_print</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_print</span><span class="p">)</span>
+        
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">button_save</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Save&quot;</span><span class="p">)</span>
+        <span class="n">button_save</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Save this report.&quot;</span><span class="p">)</span>
+        <span class="n">button_save</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onSave</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">button_save</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_save</span><span class="p">)</span>
+        
+        <span class="c"># panel for report page</span>
+        <span class="c">#panel = wx.Panel(self, -1)</span>
+        <span class="n">vbox</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>
+        <span class="c"># html window</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hwindow</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlWindow</span><span class="p">(</span><span class="bp">self</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">BORDER</span><span class="p">)</span>
+        <span class="c"># set the html page with the report string</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hwindow</span><span class="o">.</span><span class="n">SetPage</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">report_html</span><span class="p">)</span>
+        
+        <span class="c"># add panels to boxsizers</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">hbox</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">hwindow</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+<div class="viewcode-block" id="ReportDialog.onSave"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.report_dialog.ReportDialog.onSave">[docs]</a>    <span class="k">def</span> <span class="nf">onSave</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Save</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># pdf supporting only on MAC, not on exe</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_pdf</span><span class="p">:</span>
+            <span class="n">wild_card</span> <span class="o">=</span> <span class="s">&#39; PDF files (*.pdf)|*.pdf|&#39;</span>
+            <span class="n">ind_cor</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">wild_card</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+            <span class="n">ind_cor</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="n">wild_card</span> <span class="o">+=</span> <span class="s">&#39;HTML files (*.html)|*.html|&#39;</span>
+        <span class="n">wild_card</span> <span class="o">+=</span> <span class="s">&#39;Text files (*.txt)|*.txt&#39;</span>
+
+        <span class="c">#todo: complete saving fig file and as a txt file</span>
+        <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="bp">self</span><span class="p">,</span> <span class="s">&quot;Choose a file&quot;</span><span class="p">,</span>
+                            <span class="n">wildcard</span><span class="o">=</span><span class="n">wild_card</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">SAVE</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">OVERWRITE_PROMPT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">CHANGE_DIR</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">SetFilterIndex</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>  <span class="c"># Set .html files to be default</span>
+
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">!=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+            <span class="k">return</span>
+        
+        <span class="n">fName</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+        <span class="n">ext_num</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetFilterIndex</span><span class="p">()</span>
+
+        <span class="c">#set file extensions</span>
+        <span class="n">img_ext</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">pic_fname</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">#PDF</span>
+        <span class="k">if</span> <span class="n">ext_num</span> <span class="o">==</span> <span class="p">(</span><span class="mi">0</span> <span class="o">+</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">ind_cor</span><span class="p">):</span>
+            <span class="c"># TODO: Sort this case out</span>
+            <span class="n">ext</span> <span class="o">=</span> <span class="s">&#39;.pdf&#39;</span>
+            
+            <span class="n">fName</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">fName</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">ext</span>
+            <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+            <span class="c">#pic (png) file path/name</span>
+            <span class="k">for</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nimages</span><span class="p">):</span>
+                <span class="n">im_ext</span> <span class="o">=</span> <span class="s">&#39;_img</span><span class="si">%s</span><span class="s">.png&#39;</span> <span class="o">%</span> <span class="n">num</span>
+                <span class="c">#img_ext.append(im_ext)</span>
+                <span class="n">pic_name</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">fName</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">im_ext</span>
+                <span class="n">pic_fname</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">pic_name</span><span class="p">)</span>
+                <span class="c"># save the image for use with pdf writer</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="n">num</span><span class="p">]</span><span class="o">.</span><span class="n">savefig</span><span class="p">(</span><span class="n">pic_name</span><span class="p">)</span>
+
+            <span class="c">#put the image path in html string</span>
+            <span class="n">report_frame</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="c">#put image name strings into the html file</span>
+            <span class="c">#Note:The str for pic_fname shouldn&#39;t be removed.</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">nimages</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="n">html</span> <span class="o">=</span> <span class="n">report_frame</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">nimages</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+                <span class="n">html</span> <span class="o">=</span> <span class="n">report_frame</span> <span class="o">%</span> <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span> <span class="nb">str</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">nimages</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
+                <span class="n">html</span> <span class="o">=</span> <span class="n">report_frame</span> <span class="o">%</span> <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span> <span class="nb">str</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">1</span><span class="p">]),</span>
+                                          <span class="nb">str</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">2</span><span class="p">]))</span>
+
+            <span class="c"># make/open file in case of absence</span>
+            <span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">fName</span><span class="p">,</span> <span class="s">&#39;w&#39;</span><span class="p">)</span>
+            <span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+            <span class="c"># write pdf as a pdf file</span>
+            <span class="n">pdf</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">HTML2PDF</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">html</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="n">fName</span><span class="p">)</span>
+            
+            <span class="c">#open pdf</span>
+            <span class="k">if</span> <span class="n">pdf</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="c">#Windows</span>
+                    <span class="n">os</span><span class="o">.</span><span class="n">startfile</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">fName</span><span class="p">))</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">try</span><span class="p">:</span>
+                        <span class="c">#Mac</span>
+                        <span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span><span class="s">&quot;open </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="n">fName</span><span class="p">)</span>
+                    <span class="k">except</span><span class="p">:</span>
+                        <span class="c">#DO not open</span>
+                        <span class="k">pass</span>
+            <span class="c">#delete image file</span>
+            <span class="k">for</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nimages</span><span class="p">):</span>
+                <span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="n">num</span><span class="p">])</span>
+            <span class="k">return</span>
+        <span class="c">#HTML + png(graph)</span>
+        <span class="k">elif</span> <span class="n">ext_num</span> <span class="o">==</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">ind_cor</span><span class="p">):</span>
+            <span class="n">ext</span> <span class="o">=</span> <span class="s">&#39;.html&#39;</span>
+            <span class="k">for</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nimages</span><span class="p">):</span>
+                <span class="n">img_ext</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&#39;_img4html</span><span class="si">%s</span><span class="s">.png&#39;</span> <span class="o">%</span> <span class="n">num</span><span class="p">)</span>
+            <span class="n">report_frame</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="c">#TEXT + pdf(graph)</span>
+        <span class="k">elif</span> <span class="n">ext_num</span> <span class="o">==</span> <span class="p">(</span><span class="mi">2</span> <span class="o">-</span> <span class="n">ind_cor</span><span class="p">):</span>
+            <span class="n">ext</span> <span class="o">=</span> <span class="s">&#39;.txt&#39;</span>
+            <span class="c"># changing the image extension actually changes the image</span>
+            <span class="c"># format on saving</span>
+            <span class="k">for</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nimages</span><span class="p">):</span>
+                <span class="n">img_ext</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&#39;_img4txt</span><span class="si">%s</span><span class="s">.pdf&#39;</span> <span class="o">%</span> <span class="n">num</span><span class="p">)</span>
+            <span class="n">report</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span>
+        
+        <span class="c">#file name</span>
+        <span class="n">fName</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">fName</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">ext</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        
+        <span class="c">#pic (png) file path/name</span>
+        <span class="k">for</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nimages</span><span class="p">):</span>
+            <span class="n">pic_name</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">fName</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">img_ext</span><span class="p">[</span><span class="n">num</span><span class="p">]</span>
+            <span class="n">pic_fname</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">pic_name</span><span class="p">)</span>
+        <span class="c">#put the image path in html string</span>
+        <span class="k">if</span> <span class="n">ext_num</span> <span class="o">==</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">ind_cor</span><span class="p">):</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">nimages</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="n">report</span> <span class="o">=</span> <span class="n">report_frame</span> <span class="o">%</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">nimages</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+                <span class="n">report</span> <span class="o">=</span> <span class="n">report_frame</span> <span class="o">%</span> <span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span>
+                                         <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">nimages</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
+                <span class="n">report</span> <span class="o">=</span> <span class="n">report_frame</span> <span class="o">%</span> <span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span>
+                                         <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">1</span><span class="p">]),</span>
+                                         <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="mi">2</span><span class="p">]))</span>
+        <span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">fName</span><span class="p">,</span> <span class="s">&#39;w&#39;</span><span class="p">)</span>
+        <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">report</span><span class="p">)</span>
+        <span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Update</span><span class="p">()</span>
+        <span class="c">#save png file using pic_fname</span>
+        <span class="k">for</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nimages</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="n">num</span><span class="p">]</span><span class="o">.</span><span class="n">savefig</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">[</span><span class="n">num</span><span class="p">])</span>
+        </div>
+<div class="viewcode-block" id="ReportDialog.onPreview"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.report_dialog.ReportDialog.onPreview">[docs]</a>    <span class="k">def</span> <span class="nf">onPreview</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Preview</span>
+<span class="sd">        </span>
+<span class="sd">        : event: Preview button event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">previewh</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlEasyPrinting</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;Printing&quot;</span><span class="p">,</span> <span class="n">parentWindow</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">previewh</span><span class="o">.</span><span class="n">PreviewText</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">report_html</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Update</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="ReportDialog.onPrint"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.report_dialog.ReportDialog.onPrint">[docs]</a>    <span class="k">def</span> <span class="nf">onPrint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Print</span>
+<span class="sd">        </span>
+<span class="sd">        : event: Print button event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">printh</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlEasyPrinting</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;Printing&quot;</span><span class="p">,</span> <span class="n">parentWindow</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">printh</span><span class="o">.</span><span class="n">PrintText</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">report_html</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Update</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="ReportDialog.OnClose"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.report_dialog.ReportDialog.OnClose">[docs]</a>    <span class="k">def</span> <span class="nf">OnClose</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Close the Dialog</span>
+<span class="sd">        </span>
+<span class="sd">        : event: Close button event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Close</span><span class="p">()</span>
+        <span class="c"># Reset memory</span>
+        <span class="c">#wx.MemoryFSHandler()</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="ReportDialog.HTML2PDF"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.report_dialog.ReportDialog.HTML2PDF">[docs]</a>    <span class="k">def</span> <span class="nf">HTML2PDF</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create a PDF file from html source string.</span>
+<span class="sd">        </span>
+<span class="sd">        : data: html string</span>
+<span class="sd">        : filename: name of file to be saved</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">import</span> <span class="nn">ho.pisa</span> <span class="kn">as</span> <span class="nn">pisa</span>
+        <span class="n">f</span> <span class="o">=</span> <span class="nb">file</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s">&quot;wb&quot;</span><span class="p">)</span>
+        <span class="c"># pisa requires some extra packages, see their web-site</span>
+        <span class="n">pdf</span> <span class="o">=</span> <span class="n">pisa</span><span class="o">.</span><span class="n">CreatePDF</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span>
+
+        <span class="c"># close the file here otherwise it will be open until quitting</span>
+        <span class="c">#the application.</span>
+        <span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Update</span><span class="p">()</span>
+        <span class="k">return</span> <span class="ow">not</span> <span class="n">pdf</span><span class="o">.</span><span class="n">err</span></div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/resultpanel.html
===================================================================
--- _modules/sas/perspectives/fitting/resultpanel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/resultpanel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,181 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.resultpanel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.resultpanel</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">FitPanel class contains fields allowing to fit  models and  data</span>
+
+<span class="sd">:note: For Fit to be performed the user should check at least one parameter</span>
+<span class="sd">    on fit Panel window.</span>
+<span class="sd">   </span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">wx.lib.newevent</span>
+<span class="kn">from</span> <span class="nn">wx.aui</span> <span class="kn">import</span> <span class="n">AuiNotebook</span> <span class="k">as</span> <span class="n">Notebook</span>
+
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>
+
+<span class="p">(</span><span class="n">PlotResultEvent</span><span class="p">,</span> <span class="n">EVT_PLOT_RESULT</span><span class="p">)</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">lib</span><span class="o">.</span><span class="n">newevent</span><span class="o">.</span><span class="n">NewEvent</span><span class="p">()</span>
+
+
+<div class="viewcode-block" id="ResultPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.resultpanel.ResultPanel">[docs]</a><span class="k">class</span> <span class="nc">ResultPanel</span><span class="p">(</span><span class="n">Notebook</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    FitPanel class contains fields allowing to fit  models and  data</span>
+<span class="sd">    </span>
+<span class="sd">    :note: For Fit to be performed the user should check at least one parameter</span>
+<span class="sd">        on fit Panel window.</span>
+<span class="sd">       </span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal name for the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;Result panel&quot;</span>
+    <span class="c">## Title to appear on top of the window</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;Result Panel&quot;</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">True</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">style</span> <span class="o">=</span> <span class="p">((</span><span class="n">wx</span><span class="o">.</span><span class="n">aui</span><span class="o">.</span><span class="n">AUI_NB_WINDOWLIST_BUTTON</span>
+                 <span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">aui</span><span class="o">.</span><span class="n">AUI_NB_DEFAULT_STYLE</span>
+                 <span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">CLIP_CHILDREN</span><span class="p">)</span>
+                 <span class="o">&amp;</span> <span class="o">~</span><span class="n">wx</span><span class="o">.</span><span class="n">aui</span><span class="o">.</span><span class="n">AUI_NB_CLOSE_ON_ACTIVE_TAB</span><span class="p">)</span>
+        <span class="n">Notebook</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">style</span> <span class="o">=</span> <span class="n">style</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">frame</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Bind</span><span class="p">(</span><span class="n">EVT_PLOT_RESULT</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_plot_results</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">frame</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_CLOSE</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="bp">None</span>
+
+<div class="viewcode-block" id="ResultPanel.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.resultpanel.ResultPanel.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">CanVeto</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">frame</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Veto</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="ResultPanel.on_plot_results"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.resultpanel.ResultPanel.on_plot_results">[docs]</a>    <span class="k">def</span> <span class="nf">on_plot_results</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">()</span>
+        <span class="n">result</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">result</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="s">&#39;convergence&#39;</span><span class="p">):</span>
+            <span class="kn">from</span> <span class="nn">bumps.gui.convergence_view</span> <span class="kn">import</span> <span class="n">ConvergenceView</span>
+            <span class="n">best</span><span class="p">,</span> <span class="n">pop</span> <span class="o">=</span> <span class="n">result</span><span class="o">.</span><span class="n">convergence</span><span class="p">[:,</span><span class="mi">0</span><span class="p">],</span> <span class="n">result</span><span class="o">.</span><span class="n">convergence</span><span class="p">[:,</span><span class="mi">1</span><span class="p">:]</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_panel</span><span class="p">(</span><span class="n">ConvergenceView</span><span class="p">)</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">best</span><span class="p">,</span> <span class="n">pop</span><span class="p">)</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="s">&#39;uncertainty_state&#39;</span><span class="p">):</span>
+            <span class="kn">from</span> <span class="nn">bumps.gui.uncertainty_view</span> <span class="kn">import</span> <span class="n">UncertaintyView</span><span class="p">,</span> <span class="n">CorrelationView</span><span class="p">,</span> <span class="n">TraceView</span>
+            <span class="kn">from</span> <span class="nn">bumps.dream.stats</span> <span class="kn">import</span> <span class="n">var_stats</span><span class="p">,</span><span class="n">format_vars</span>
+            <span class="n">stats</span> <span class="o">=</span> <span class="n">var_stats</span><span class="p">(</span><span class="n">result</span><span class="o">.</span><span class="n">uncertainty_state</span><span class="o">.</span><span class="n">draw</span><span class="p">())</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="n">format_vars</span><span class="p">(</span><span class="n">stats</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_panel</span><span class="p">(</span><span class="n">CorrelationView</span><span class="p">)</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">result</span><span class="o">.</span><span class="n">uncertainty_state</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_panel</span><span class="p">(</span><span class="n">UncertaintyView</span><span class="p">)</span><span class="o">.</span><span class="n">update</span><span class="p">((</span><span class="n">result</span><span class="o">.</span><span class="n">uncertainty_state</span><span class="p">,</span><span class="n">stats</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_panel</span><span class="p">(</span><span class="n">TraceView</span><span class="p">)</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">result</span><span class="o">.</span><span class="n">uncertainty_state</span><span class="p">)</span>
+            <span class="c"># TODO: stats should be stored in result rather than computed in bumps UncertaintyView</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">frame</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">))</span>
+            <span class="k">print</span>
+</div>
+<div class="viewcode-block" id="ResultPanel.get_frame"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.resultpanel.ResultPanel.get_frame">[docs]</a>    <span class="k">def</span> <span class="nf">get_frame</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">frame</span>
+</div>
+<div class="viewcode-block" id="ResultPanel.add_panel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.resultpanel.ResultPanel.add_panel">[docs]</a>    <span class="k">def</span> <span class="nf">add_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">panel</span><span class="p">):</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">AddPage</span><span class="p">(</span><span class="n">panel</span><span class="p">,</span> <span class="n">panel</span><span class="o">.</span><span class="n">title</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="ResultPanel.get_panel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.resultpanel.ResultPanel.get_panel">[docs]</a>    <span class="k">def</span> <span class="nf">get_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">panel_class</span><span class="p">):</span>
+        <span class="k">for</span> <span class="n">idx</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PageCount</span><span class="p">):</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPageText</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span> <span class="o">==</span> <span class="n">panel_class</span><span class="o">.</span><span class="n">title</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">GetPage</span><span class="p">(</span><span class="n">idx</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">panel</span> <span class="o">=</span> <span class="n">panel_class</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">add_panel</span><span class="p">(</span><span class="n">panel</span><span class="p">)</span>
+            <span class="k">return</span> <span class="n">panel</span></div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/simfitpage.html
===================================================================
--- _modules/sas/perspectives/fitting/simfitpage.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/simfitpage.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,1026 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.simfitpage &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.simfitpage</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Simultaneous fit page</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">sys</span><span class="o">,</span><span class="nn">re</span><span class="o">,</span><span class="nn">string</span><span class="o">,</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">wx.lib.newevent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span> 
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span>
+<span class="kn">from</span> <span class="nn">wx.lib.scrolledpanel</span> <span class="kn">import</span> <span class="n">ScrolledPanel</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">PanelOnFocusEvent</span>
+<span class="c">#Control panel width </span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;darwin&quot;</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">PANEL_WID</span> <span class="o">=</span> <span class="mi">420</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">PANEL_WID</span> <span class="o">=</span> <span class="mi">490</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+       
+            
+<div class="viewcode-block" id="get_fittableParam"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.get_fittableParam">[docs]</a><span class="k">def</span> <span class="nf">get_fittableParam</span><span class="p">(</span><span class="n">model</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    return list of fittable parameters name of a model</span>
+<span class="sd">    </span>
+<span class="sd">    :param model: the model used</span>
+<span class="sd">    </span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">fittable_param</span> <span class="o">=</span> <span class="p">[]</span>
+    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">getParamList</span><span class="p">():</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span>  <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">getDispParamList</span><span class="p">():</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">non_fittable</span><span class="p">:</span>
+                <span class="n">fittable_param</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+            
+    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">fixed</span><span class="p">:</span>
+        <span class="n">fittable_param</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+        
+    <span class="k">return</span> <span class="n">fittable_param</span>
+
+</div>
+<div class="viewcode-block" id="SimultaneousFitPage"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.SimultaneousFitPage">[docs]</a><span class="k">class</span> <span class="nc">SimultaneousFitPage</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Simultaneous fitting panel</span>
+<span class="sd">    All that needs to be defined are the</span>
+<span class="sd">    two data members window_name and window_caption</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal name for the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;simultaneous Fit page&quot;</span>
+    <span class="c">## Title to appear on top of the window</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;Simultaneous Fit Page&quot;</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">page_finder</span><span class="o">=</span><span class="p">{},</span> <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">batch_on</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
+                     <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</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">FULL_REPAINT_ON_RESIZE</span><span class="p">,</span>
+                               <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">)</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Simultaneous page display</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        <span class="c">##Font size</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">uid</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span> <span class="o">=</span> <span class="n">batch_on</span>
+        <span class="c">## store page_finder</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span> <span class="o">=</span> <span class="n">page_finder</span>
+        <span class="c">## list contaning info to set constraint</span>
+        <span class="c">## look like self.constraint_dict[page_id]= page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">constraint_dict</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="c">## item list</span>
+        <span class="c"># self.constraints_list=[combobox1, combobox2,=,textcrtl, button ]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## list of current model</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## selected mdoel to fit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">## number of constraint</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nb_constraint</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">uid</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="c">## draw page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">define_page_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">draw_page</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="SimultaneousFitPage.define_page_structure"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.SimultaneousFitPage.define_page_structure">[docs]</a>    <span class="k">def</span> <span class="nf">define_page_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create empty sizer for a panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer1</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</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>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer1</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WID</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WID</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WID</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="SimultaneousFitPage.set_scroll"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.SimultaneousFitPage.set_scroll">[docs]</a>    <span class="k">def</span> <span class="nf">set_scroll</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+         </div>
+<div class="viewcode-block" id="SimultaneousFitPage.set_layout"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.SimultaneousFitPage.set_layout">[docs]</a>    <span class="k">def</span> <span class="nf">set_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        layout</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="o">.</span><span class="n">Fit</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_scroll</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="SimultaneousFitPage.onRemove"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.SimultaneousFitPage.onRemove">[docs]</a>    <span class="k">def</span> <span class="nf">onRemove</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Remove constraint fields</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">hide_constraint</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_hide_constraint</span><span class="p">()</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">:</span>
+            <span class="n">length</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">()</span> <span class="o">==</span> <span class="n">item</span><span class="p">[</span><span class="n">length</span> <span class="o">-</span> <span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">GetId</span><span class="p">():</span>
+                <span class="n">sizer</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="n">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span>
+                <span class="n">sizer</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sizer_constraints</span><span class="o">.</span><span class="n">Remove</span><span class="p">(</span><span class="n">sizer</span><span class="p">)</span>
+                <span class="c">#self.SetScrollbars(20,20,25,65)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">nb_constraint</span> <span class="o">-=</span> <span class="mi">1</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+                <span class="k">break</span>
+
+        <span class="c">#self._onAdd_constraint(None)</span>
+             </div>
+<div class="viewcode-block" id="SimultaneousFitPage.onFit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.SimultaneousFitPage.onFit">[docs]</a>    <span class="k">def</span> <span class="nf">onFit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        signal for fitting</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c"># check if the current page a simultaneous fit page or a batch page</span>
+        <span class="k">if</span> <span class="bp">self</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">sim_page</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">sim_page</span><span class="o">.</span><span class="n">uid</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span>
+
+        <span class="c">## making sure all parameters content a constraint</span>
+        <span class="c">## validity of the constraint expression is own by fit engine</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">_fit_engine</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="s">&quot;park&quot;</span><span class="p">,</span><span class="s">&quot;bumps&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;The FitEnging will be set to &#39;Park&#39; fit engine</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; for the simultaneous fit...&quot;</span>
+            <span class="c">#wx.MessageBox(msg, &#39;Info&#39;)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span>\
+                            <span class="s">&quot;Fitting: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">))</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">show_constraint</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_constraint</span><span class="p">():</span>
+                <span class="k">return</span>
+        <span class="c">## model was actually selected from this page to be fit</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">_reset_schedule_problem</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">schedule_for_fit</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">uid</span><span class="o">=</span><span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span> 
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">onFit</span><span class="p">(</span><span class="n">uid</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">uid</span><span class="p">):</span>
+                    <span class="k">return</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Select at least one parameter to fit in the FitPages.&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Select at least one model check box to fit &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+           </div>
+<div class="viewcode-block" id="SimultaneousFitPage.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.SimultaneousFitPage.set_manager">[docs]</a>    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set panel manager</span>
+<span class="sd">        </span>
+<span class="sd">        :param manager: instance of plugin fitting</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">manager</span> <span class="o">=</span> <span class="n">manager</span>
+       </div>
+<div class="viewcode-block" id="SimultaneousFitPage.check_all_model_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.SimultaneousFitPage.check_all_model_name">[docs]</a>    <span class="k">def</span> <span class="nf">check_all_model_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        check all models names</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+                    <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                
+            <span class="c">## constraint info</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_model</span><span class="p">()</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+                <span class="c">## display constraint fields</span>
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">show_constraint</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="ow">and</span>\
+                                 <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_show_all_constraint</span><span class="p">()</span> 
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_show_constraint</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list</span><span class="p">:</span>
+                <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span> 
+                
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+                <span class="c">##constraint info</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_hide_constraint</span><span class="p">()</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">_update_easy_setup_cb</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="SimultaneousFitPage.check_model_name"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.SimultaneousFitPage.check_model_name">[docs]</a>    <span class="k">def</span> <span class="nf">check_model_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Save information related to checkbox and their states</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">cbox</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        
+        <span class="c">## display constraint fields</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_model</span><span class="p">()</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">show_constraint</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="ow">and</span>\
+                             <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_show_all_constraint</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_show_constraint</span><span class="p">()</span>
+
+        <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="c">##constraint info</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_hide_constraint</span><span class="p">()</span>
+                        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_update_easy_setup_cb</span><span class="p">()</span>
+        <span class="c">## set the value of the main check button</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_list</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            <span class="k">return</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            </div>
+    <span class="k">def</span> <span class="nf">_update_easy_setup_cb</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Update easy setup combobox on selecting a model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="c"># when there is something</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="c"># when there is nothing</span>
+                <span class="k">pass</span>
+            <span class="c">#for id, model in self.constraint_dict.iteritems():</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="p">:</span>
+                <span class="n">model</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span>
+                <span class="c">## check if all parameters have been selected for constraint</span>
+                <span class="c">## then do not allow add constraint on parameters</span>
+                <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">GetItems</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> <span class="n">model</span><span class="p">)</span>
+                <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="o">.</span><span class="n">GetItems</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> <span class="n">model</span><span class="p">)</span>
+                <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox</span><span class="o">.</span><span class="n">GetItems</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> <span class="n">model</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+<div class="viewcode-block" id="SimultaneousFitPage.draw_page"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.SimultaneousFitPage.draw_page">[docs]</a>    <span class="k">def</span> <span class="nf">draw_page</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw a sizer containing couples of data and model </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">constraint_dict</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nb_constraint</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_list</span><span class="p">:</span>
+                <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">schedule_for_fit</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">uid</span><span class="o">=</span><span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
+                
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer1</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="n">box_description</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Fit Combinations&quot;</span><span class="p">)</span>
+        <span class="n">boxsizer1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">box_description</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">sizer_title</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>
+        <span class="n">sizer_couples</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="c">#------------------------------------------------------</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; No fit combinations are found! </span><span class="se">\n\n</span><span class="s">&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; Please load data and set up &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;at least two fit panels first...&quot;</span>
+            <span class="n">sizer_title</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">msg</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c">## store model</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_store_model</span><span class="p">()</span>
+        
+            <span class="bp">self</span><span class="o">.</span><span class="n">cb1</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Select all&#39;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</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="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">cb1</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">check_all_model_name</span><span class="p">)</span>
+            
+            <span class="n">sizer_title</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</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">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+            <span class="n">sizer_title</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cb1</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">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+            
+            <span class="c">## draw list of model and data name</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_fill_sizer_model_list</span><span class="p">(</span><span class="n">sizer_couples</span><span class="p">)</span>
+            <span class="c">## draw the sizer containing constraint info</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_fill_sizer_constraint</span><span class="p">()</span>
+            <span class="c">## draw fit button</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_fill_sizer_fit</span><span class="p">()</span>
+        <span class="c">#--------------------------------------------------------</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_title</span><span class="p">,</span> <span class="n">flag</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span> 
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_couples</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">flag</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer1</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="c">#self.SetScrollbars(20,20,25,65)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">AdjustScrollbars</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_store_model</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">         Store selected model</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="p">:</span>
+            <span class="n">model</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span>
+            <span class="n">page_id</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">constraint_dict</span><span class="p">[</span><span class="n">page_id</span><span class="p">]</span> <span class="o">=</span> <span class="n">model</span>
+                   
+    <span class="k">def</span> <span class="nf">_display_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show fields to add constraint</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Select at least 1 model to add constraint &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+            <span class="c">## hide button</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_hide_constraint</span><span class="p">()</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">show_constraint</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_show_all_constraint</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_show_constraint</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            <span class="k">return</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_hide_constraint</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            <span class="k">return</span>
+       
+    <span class="k">def</span> <span class="nf">_show_all_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show constraint fields</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">box_description</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&quot;Easy Setup &quot;</span><span class="p">)</span>
+        <span class="n">boxsizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">box_description</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>     
+        <span class="n">sizer_constraint</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_modelcb</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_modelcb</span><span class="p">)</span>
+        <span class="n">egal_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot; = &quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_button</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span> <span class="s">&#39;Set All&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_button</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_set_all_equal</span><span class="p">,</span>
+                             <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">set_button</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="n">set_tip</span> <span class="o">=</span> <span class="s">&quot;Add constraints for all the adjustable parameters &quot;</span>
+        <span class="n">set_tip</span> <span class="o">+=</span> <span class="s">&quot;(checked in FitPages) if exist.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_button</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">set_tip</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_button</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        
+        <span class="k">for</span> <span class="nb">id</span><span class="p">,</span> <span class="n">model</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraint_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c">## check if all parameters have been selected for constraint</span>
+            <span class="c">## then do not allow add constraint on parameters</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> <span class="n">model</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="k">for</span> <span class="nb">id</span><span class="p">,</span> <span class="n">model</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraint_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c">## check if all parameters have been selected for constraint</span>
+            <span class="c">## then do not allow add constraint on parameters</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> <span class="n">model</span><span class="p">)</span>
+        <span class="n">boxsizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="p">,</span>
+                             <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">boxsizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;.parameters&quot;</span><span class="p">),</span>
+                             <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+        <span class="n">boxsizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">egal_txt</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+        <span class="n">boxsizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="p">,</span>
+                             <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">boxsizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;.parameters&quot;</span><span class="p">),</span>
+                             <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span><span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+        <span class="n">boxsizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">boxsizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">set_button</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+        <span class="n">sizer_constraint</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_all_constraints</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span><span class="n">before</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
+                             <span class="n">item</span><span class="o">=</span><span class="n">sizer_constraint</span><span class="p">,</span>
+                             <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_all_constraints</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="c">#self.SetScrollbars(20,20,25,65)</span>
+    
+    <span class="k">def</span> <span class="nf">_on_select_modelcb</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On select model left or right combobox</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> <span class="o">==</span>\
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_button</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="n">flag</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_on_set_all_equal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On set button</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">length</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">length</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">param_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">param_listB</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">selection</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="n">model_left</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">selection</span><span class="p">)</span>
+        <span class="n">selectionB</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="n">model_right</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="n">modelB</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">selectionB</span><span class="p">)</span>
+        <span class="k">for</span> <span class="nb">id</span><span class="p">,</span> <span class="n">dic_model</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraint_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="k">if</span> <span class="n">model</span> <span class="o">==</span> <span class="n">dic_model</span><span class="p">:</span>
+                <span class="n">param_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">get_param2fit</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">modelB</span> <span class="o">==</span> <span class="n">dic_model</span><span class="p">:</span>
+                <span class="n">param_listB</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">get_param2fit</span><span class="p">()</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">param_list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">param_listB</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="k">break</span>
+        <span class="n">num_cbox</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">has_param</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">param_list</span><span class="p">:</span>
+            <span class="n">num_cbox</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="k">if</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">param_listB</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="n">model_left</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_model</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">param_cbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">param_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">param</span><span class="p">),</span> <span class="n">model</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">param_cbox</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">param</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">ctl2</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">model_right</span> <span class="o">+</span> <span class="s">&quot;.&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">param</span><span class="p">)))</span>
+                <span class="n">has_param</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="k">if</span> <span class="n">num_cbox</span> <span class="o">==</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">param_list</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">):</span>
+                    <span class="k">break</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_show_constraint</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_constraints</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetScrollbars</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">65</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">has_param</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; There is no adjustable parameter (checked to fit)&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; either one of the models.&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">info</span><span class="o">=</span><span class="s">&quot;warning&quot;</span><span class="p">,</span>
+                                                         <span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; The constraints are added.&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span>
+                                                         <span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+
+    <span class="k">def</span> <span class="nf">_show_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show constraint fields</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btAdd</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">nb_fit_param</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">for</span> <span class="nb">id</span><span class="p">,</span> <span class="n">model</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraint_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="n">nb_fit_param</span> <span class="o">+=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">get_param2fit</span><span class="p">())</span>
+            <span class="c">##Don&#39;t add anymore</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">)</span> <span class="o">==</span> <span class="n">nb_fit_param</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Cannot add another constraint .Maximum of number &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Parameters name reached </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">nb_fit_param</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sizer_constraints</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+                <span class="k">return</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model_toFit</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Select at least 1 model to add constraint &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sizer_constraints</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            <span class="k">return</span>
+            
+        <span class="n">sizer_constraint</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>
+        <span class="n">model_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+        <span class="n">model_cbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="n">param_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span> <span class="p">)</span>
+        <span class="n">param_cbox</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        
+        <span class="c">#This is for GetCLientData() _on_select_param: Was None return on MAC.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">param_cbox</span> <span class="o">=</span> <span class="n">param_cbox</span>
+        
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="n">param_cbox</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_param</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">ctl2</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">egal_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot; = &quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btRemove</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span><span class="s">&#39;Remove&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btRemove</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onRemove</span><span class="p">,</span> 
+                           <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">btRemove</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btRemove</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Remove constraint.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btRemove</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;btAdd&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">btAdd</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="k">for</span> <span class="nb">id</span><span class="p">,</span> <span class="n">model</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraint_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="c">## check if all parameters have been selected for constraint</span>
+            <span class="c">## then do not allow add constraint on parameters</span>
+            <span class="n">model_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> <span class="n">model</span><span class="p">)</span>
+            
+        <span class="c">#This is for GetCLientData() passing to self._on_select_param: Was None return on MAC.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox</span> <span class="o">=</span> <span class="n">model_cbox</span>
+           
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="n">model_cbox</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_select_model</span><span class="p">)</span>
+        <span class="n">sizer_constraint</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="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">sizer_constraint</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">model_cbox</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">sizer_constraint</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">param_cbox</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+        <span class="n">sizer_constraint</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">egal_txt</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+        <span class="n">sizer_constraint</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ctl2</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">sizer_constraint</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">btRemove</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
+      
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_constraints</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span><span class="n">before</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">nb_constraint</span><span class="p">,</span>
+                        <span class="n">item</span><span class="o">=</span><span class="n">sizer_constraint</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span>
+                        <span class="n">border</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">model_cbox</span><span class="p">,</span> <span class="n">param_cbox</span><span class="p">,</span> <span class="n">egal_txt</span><span class="p">,</span>
+                                    <span class="bp">self</span><span class="o">.</span><span class="n">ctl2</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">btRemove</span><span class="p">,</span> <span class="n">sizer_constraint</span><span class="p">])</span>
+    
+        <span class="bp">self</span><span class="o">.</span><span class="n">nb_constraint</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_constraints</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_hide_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        hide buttons related constraint</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="nb">id</span> <span class="ow">in</span>  <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">clear_model_param</span><span class="p">()</span>
+               
+        <span class="bp">self</span><span class="o">.</span><span class="n">nb_constraint</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">constraint_dict</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s">&quot;btAdd&quot;</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">btAdd</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_store_model</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_left</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox_right</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_all_constraints</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_all_constraints</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_constraints</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_constraints</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+            
+    <span class="k">def</span> <span class="nf">_on_select_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        fill combox box with list of parameters</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">param_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="c">##This way PC/MAC both work, instead of using event.GetClientData().</span>
+        <span class="n">n</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">()</span>
+        <span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">n</span><span class="p">)</span>
+        <span class="k">for</span> <span class="nb">id</span><span class="p">,</span> <span class="n">dic_model</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraint_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="k">if</span> <span class="n">model</span> <span class="o">==</span> <span class="n">dic_model</span><span class="p">:</span>
+                <span class="n">param_list</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">get_param2fit</span><span class="p">()</span>
+                <span class="c">#break</span>
+        <span class="n">length</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">length</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">param_cbox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">[</span><span class="n">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
+        <span class="n">param_cbox</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="c">## insert only fittable paramaters</span>
+        <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">param_list</span><span class="p">:</span>
+            <span class="n">param_cbox</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">param</span><span class="p">),</span> <span class="n">model</span><span class="p">)</span>
+
+        <span class="n">param_cbox</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btRemove</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btAdd</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_on_select_param</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Store the appropriate constraint in the page_finder</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">##This way PC/MAC both work, instead of using event.GetClientData().</span>
+        <span class="c">#n = self.param_cbox.GetCurrentSelection()</span>
+        <span class="c">#model = self.param_cbox.GetClientData(n)</span>
+        <span class="c">#param = event.GetString()</span>
+      
+        <span class="n">length</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">length</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">egal_txt</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">[</span><span class="n">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span>
+        <span class="n">egal_txt</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+        <span class="n">ctl2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">[</span><span class="n">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">][</span><span class="mi">3</span><span class="p">]</span>
+        <span class="n">ctl2</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_onAdd_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Add another line for constraint</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">show_constraint</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Select Yes to add Constraint &quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+            <span class="k">return</span>
+        <span class="c">## check that a constraint is added</span>
+        <span class="c"># before allow to add another constraint</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">:</span>
+            <span class="n">model_cbox</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="k">if</span> <span class="n">model_cbox</span><span class="o">.</span><span class="n">GetString</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Select a model Name! &quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                <span class="k">return</span> 
+            <span class="n">param_cbox</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            <span class="k">if</span> <span class="n">param_cbox</span><span class="o">.</span><span class="n">GetString</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Select a parameter Name! &quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                <span class="k">return</span> 
+            <span class="n">ctl2</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span>
+            <span class="k">if</span> <span class="n">ctl2</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                <span class="n">model</span> <span class="o">=</span> <span class="n">param_cbox</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span>\
+                                            <span class="n">param_cbox</span><span class="o">.</span><span class="n">GetCurrentSelection</span><span class="p">())</span>
+                <span class="k">if</span> <span class="n">model</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Enter a constraint for </span><span class="si">%s</span><span class="s">.</span><span class="si">%s</span><span class="s">! &quot;</span><span class="o">%</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> 
+                                                        <span class="n">param_cbox</span><span class="o">.</span><span class="n">GetString</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
+                <span class="k">else</span><span class="p">:</span>
+                     <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Enter a constraint&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                <span class="k">return</span>
+        <span class="c">## some model or parameters can be constrained</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_show_constraint</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_fill_sizer_fit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw fit button</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="n">box_description</span><span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Fit &quot;</span><span class="p">)</span>
+        <span class="n">boxsizer1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">box_description</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">sizer_button</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>
+          
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span> <span class="s">&#39;Fit&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">DefaultSize</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onFit</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btFit</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Perform fit.&quot;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="n">text</span> <span class="o">=</span> <span class="s">&quot; Fit in Parallel all Data set and model selected.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">text</span> <span class="o">=</span> <span class="s">&quot;     Note: Park fitting engine will be used automatically. </span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">text</span> <span class="o">+=</span> <span class="s">&quot;     This page requires at least one FitPage with a data </span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">text</span> <span class="o">+=</span> <span class="s">&quot;       and a model set for fitting.&quot;</span>
+            <span class="c">#text+= &quot;automatically for more than 2 combinations checked&quot;</span>
+        <span class="n">text_hint</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span>
+        
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">text_hint</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">btFit</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_button</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span><span class="n">border</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer1</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer3</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_fill_sizer_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Fill sizer containing constraint info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Select at least 2 model to add constraint &quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">IsShown</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="k">return</span>
+        <span class="n">box_description</span><span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Fit Constraints&quot;</span><span class="p">)</span>
+        <span class="n">boxsizer1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">box_description</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">sizer_title</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_all_constraints</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_constraints</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>
+        <span class="n">sizer_button</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>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">hide_constraint</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;No&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</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">RB_GROUP</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_constraint</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Yes&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">30</span><span class="p">))</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_display_constraint</span><span class="p">,</span>
+                  <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">hide_constraint</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_display_constraint</span><span class="p">,</span>
+                  <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">show_constraint</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">hide_constraint</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">show_constraint</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hide_constraint</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_constraint</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        
+        <span class="n">sizer_title</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot; Model&quot;</span><span class="p">))</span>
+        <span class="n">sizer_title</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">sizer_title</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot; Parameter&quot;</span><span class="p">))</span>
+        <span class="n">sizer_title</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">sizer_title</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="bp">self</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="s">&quot; Add Constraint?&quot;</span><span class="p">)</span> <span class="p">)</span>
+        <span class="n">sizer_title</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        <span class="n">sizer_title</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">show_constraint</span><span class="p">)</span>
+        <span class="n">sizer_title</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">hide_constraint</span><span class="p">)</span>
+        <span class="n">sizer_title</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">btAdd</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">(),</span> <span class="s">&#39;Add&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btAdd</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onAdd_constraint</span><span class="p">,</span>
+                        <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">btAdd</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btAdd</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Add another constraint?&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">btAdd</span><span class="o">.</span><span class="n">Hide</span><span class="p">()</span>
+     
+        <span class="n">text_hint</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                  <span class="s">&quot;Example: [M0][paramter] = M1.parameter&quot;</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">text_hint</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">btAdd</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+       
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_title</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span><span class="n">border</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer_all_constraints</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span>
+                      <span class="n">border</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer_constraints</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span>
+                      <span class="n">border</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_button</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="n">border</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer1</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer2</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+       
+        <span class="c">#self.SetScrollbars(20,20,25,65)</span>
+    
+    <span class="k">def</span> <span class="nf">_set_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get values from the constrainst textcrtl ,parses them into model name</span>
+<span class="sd">        parameter name and parameters values.</span>
+<span class="sd">        store them in a list self.params .when when params is not empty</span>
+<span class="sd">        set_model uses it to reset the appropriate model</span>
+<span class="sd">        and its appropriates parameters</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraints_list</span><span class="p">:</span>
+            <span class="n">select0</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">select0</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">NOT_FOUND</span><span class="p">:</span>
+                <span class="k">continue</span>
+            <span class="n">model</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetClientData</span><span class="p">(</span><span class="n">select0</span><span class="p">)</span>
+            <span class="n">select1</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">select1</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">NOT_FOUND</span><span class="p">:</span>
+                <span class="k">continue</span>
+            <span class="n">param</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">GetString</span><span class="p">(</span><span class="n">select1</span><span class="p">)</span>
+            <span class="n">constraint</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">param</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                <span class="n">param</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Constraint will be ignored!. missing parameters&quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; in combobox to set constraint! &quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+            <span class="k">for</span> <span class="nb">id</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">constraint_dict</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="k">if</span> <span class="n">model</span> <span class="o">==</span> <span class="n">value</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">constraint</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Constraint will be ignored!. missing value&quot;</span>
+                        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; in textcrtl to set constraint! &quot;</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                        <span class="n">constraint</span> <span class="o">=</span> <span class="bp">None</span>
+                    <span class="k">if</span> <span class="nb">str</span><span class="p">(</span><span class="n">param</span><span class="p">)</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">get_param2fit</span><span class="p">():</span>
+                        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot; Checking constraint for parameter: </span><span class="si">%s</span><span class="s"> &quot;</span><span class="p">,</span> <span class="n">param</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">model_name</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+                        <span class="n">fitpage</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">get_fit_tab_caption</span><span class="p">()</span>
+                        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;All constrainted parameters must be set &quot;</span>
+                        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; adjustable: &#39;</span><span class="si">%s</span><span class="s">.</span><span class="si">%s</span><span class="s">&#39; &quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">model_name</span><span class="p">,</span> <span class="n">param</span><span class="p">)</span>
+                        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;is NOT checked in &#39;</span><span class="si">%s</span><span class="s">&#39;. &quot;</span> <span class="o">%</span> <span class="n">fitpage</span>
+                        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; Please check it to fit or&quot;</span>
+                        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; remove the line of the constraint.&quot;</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                                <span class="n">StatusEvent</span><span class="p">(</span><span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span> <span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+                        <span class="k">return</span> <span class="bp">False</span>
+                        
+                    <span class="k">for</span> <span class="n">fid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">iterkeys</span><span class="p">():</span>
+                        <span class="c"># wrap in param/constraint in str() to remove unicode</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="p">[</span><span class="nb">id</span><span class="p">]</span><span class="o">.</span><span class="n">set_model_param</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">param</span><span class="p">),</span>
+                                                        <span class="nb">str</span><span class="p">(</span><span class="n">constraint</span><span class="p">),</span> <span class="n">fid</span><span class="o">=</span><span class="n">fid</span><span class="p">)</span>
+                    <span class="k">break</span>
+        <span class="k">return</span> <span class="bp">True</span>
+    
+    <span class="k">def</span> <span class="nf">_fill_sizer_model_list</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sizer</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Receive a dictionary containing information to display model name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="nb">list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Clear</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+        <span class="n">new_name</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;  Model Title &#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">ALIGN_CENTER</span><span class="p">)</span>
+        <span class="n">new_name</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;orange&#39;</span><span class="p">)</span>
+        <span class="n">new_name</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">new_name</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">2</span>
+        <span class="n">model_type</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;  Model &#39;</span><span class="p">)</span>
+        <span class="n">model_type</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;grey&#39;</span><span class="p">)</span>
+        <span class="n">model_type</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">model_type</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">data_used</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;  Data &#39;</span><span class="p">)</span>
+        <span class="n">data_used</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;grey&#39;</span><span class="p">)</span>
+        <span class="n">data_used</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">data_used</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">tab_used</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;  FitPage &#39;</span><span class="p">)</span>
+        <span class="n">tab_used</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;grey&#39;</span><span class="p">)</span>
+        <span class="n">tab_used</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">tab_used</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="k">for</span> <span class="nb">id</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="k">if</span> <span class="nb">id</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">opened_pages</span><span class="p">:</span>
+                <span class="k">continue</span>
+
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_page_by_id</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+                <span class="k">continue</span>
+            
+            <span class="n">data_list</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="n">model_list</span> <span class="o">=</span> <span class="p">[]</span>
+            <span class="c"># get data name and model objetta</span>
+            <span class="k">for</span> <span class="n">fitproblem</span> <span class="ow">in</span> <span class="n">value</span><span class="o">.</span><span class="n">get_fit_problem</span><span class="p">():</span>
+                
+                <span class="n">data</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_fit_data</span><span class="p">()</span>
+                <span class="k">if</span> <span class="ow">not</span> <span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+                    <span class="k">continue</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="s">&#39;-&#39;</span>
+                <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">:</span>
+                    <span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+                <span class="n">data_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+                    
+                <span class="n">model</span> <span class="o">=</span> <span class="n">fitproblem</span><span class="o">.</span><span class="n">get_model</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">model</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="k">continue</span>
+                <span class="n">model_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">model</span><span class="p">)</span>
+           
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">model_list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="k">continue</span>
+            <span class="c"># Draw sizer</span>
+            <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">model</span> <span class="o">=</span> <span class="n">model_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="s">&#39;_&#39;</span>
+            <span class="k">if</span> <span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+            <span class="n">cb</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+            <span class="n">cb</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="n">cb</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="n">model</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">data</span><span class="o">.</span><span class="n">is_data</span><span class="p">)</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">cb</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> 
+                       <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</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="bp">self</span><span class="p">,</span> <span class="n">cb</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">check_model_name</span><span class="p">)</span>
+            <span class="n">ix</span> <span class="o">+=</span> <span class="mi">2</span> 
+            <span class="nb">type</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span>
+            <span class="n">model_type</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="nb">type</span><span class="p">))</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">model_type</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                      <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_on</span><span class="p">:</span>
+                <span class="n">data_used</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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>
+                <span class="n">data_used</span><span class="o">.</span><span class="n">AppendItems</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span>
+                <span class="n">data_used</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">data_used</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">data_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            
+            <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">data_used</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                      <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">caption</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">get_fit_tab_caption</span><span class="p">()</span>
+            <span class="n">tab_caption_used</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">caption</span><span class="p">))</span>
+            <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">tab_caption_used</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                      <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+            
+            <span class="bp">self</span><span class="o">.</span><span class="n">model_list</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">cb</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">model</span><span class="p">])</span>
+            
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                  <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+    
+<div class="viewcode-block" id="SimultaneousFitPage.on_set_focus"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.simfitpage.SimultaneousFitPage.on_set_focus">[docs]</a>    <span class="k">def</span> <span class="nf">on_set_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        The  derivative class is on focus if implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">PanelOnFocusEvent</span><span class="p">(</span><span class="n">panel</span><span class="o">=</span><span class="bp">self</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">page_finder</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">get_page_finder</span><span class="p">()</span></div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/fitting/utils.html
===================================================================
--- _modules/sas/perspectives/fitting/utils.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/fitting/utils.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,123 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.fitting.utils &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.fitting" href="../fitting.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" accesskey="U">sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.fitting.utils</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Module contains functions frequently used in this package</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">numpy</span>
+
+
+<div class="viewcode-block" id="get_weight"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.fitting.html#sas.perspectives.fitting.utils.get_weight">[docs]</a><span class="k">def</span> <span class="nf">get_weight</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">is2d</span><span class="p">,</span> <span class="n">flag</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Received flag and compute error on data.</span>
+<span class="sd">    :param flag: flag to transform error of data.</span>
+<span class="sd">    :param is2d: flag to distinguish 1D to 2D Data</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">weight</span> <span class="o">=</span> <span class="bp">None</span>
+    <span class="k">if</span> <span class="n">is2d</span><span class="p">:</span>
+        <span class="n">dy_data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">err_data</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">data</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="n">dy_data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">dy</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">y</span>
+    <span class="k">if</span> <span class="n">flag</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="n">weight</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones_like</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+    <span class="k">elif</span> <span class="n">flag</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+        <span class="n">weight</span> <span class="o">=</span> <span class="n">dy_data</span>
+    <span class="k">elif</span> <span class="n">flag</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+        <span class="n">weight</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">data</span><span class="p">))</span>
+    <span class="k">elif</span> <span class="n">flag</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
+        <span class="n">weight</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+    <span class="k">return</span> <span class="n">weight</span></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../fitting.html" >sas.perspectives.fitting</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/invariant.html
===================================================================
--- _modules/sas/perspectives/invariant.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/invariant.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,136 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.invariant &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../index.html" />
+    <link rel="up" title="Module code" href="../../index.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../index.html" accesskey="U">Module code</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.invariant</h1><div class="highlight"><pre>
+<span class="n">PLUGIN_ID</span> <span class="o">=</span> <span class="s">&quot;Invariant plug-in 1.0&quot;</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">from</span> <span class="nn">invariant</span> <span class="kn">import</span> <span class="o">*</span>
+<span class="kn">from</span> <span class="nn">distutils.filelist</span> <span class="kn">import</span> <span class="n">findall</span>
+<div class="viewcode-block" id="get_data_path"><a class="viewcode-back" href="../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.get_data_path">[docs]</a><span class="k">def</span> <span class="nf">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c"># Check for data path in the package</span>
+    <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">),</span> <span class="n">media</span><span class="p">)</span>
+    <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+        <span class="k">return</span> <span class="n">path</span>
+
+    <span class="c"># Check for data path next to exe/zip file.</span>
+    <span class="c"># If we are inside a py2exe zip file, we need to go up</span>
+    <span class="c"># to get to the directory containing </span>
+    <span class="c"># the media for this module</span>
+    <span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">__file__</span><span class="p">)</span>
+    <span class="c">#Look for maximum n_dir up of the current dir to find media</span>
+    <span class="n">n_dir</span> <span class="o">=</span> <span class="mi">12</span>
+    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">n_dir</span><span class="p">):</span>
+        <span class="n">path</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">media_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">media</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">media_path</span><span class="p">):</span>
+            <span class="n">module_media_path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">media_path</span><span class="p">,</span> <span class="s">&#39;invariant_media&#39;</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">module_media_path</span><span class="p">):</span>
+                <span class="k">return</span> <span class="n">module_media_path</span>
+            <span class="k">return</span> <span class="n">media_path</span>
+   
+    <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&#39;Could not find invariant media files&#39;</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="data_files"><a class="viewcode-back" href="../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.data_files">[docs]</a><span class="k">def</span> <span class="nf">data_files</span><span class="p">():</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Return the data files associated with media invariant.</span>
+<span class="sd">    </span>
+<span class="sd">    The format is a list of (directory, [files...]) pairs which can be</span>
+<span class="sd">    used directly in setup(...,data_files=...) for setup.py.</span>
+
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">data_files</span> <span class="o">=</span> <span class="p">[]</span>
+    <span class="n">path</span> <span class="o">=</span> <span class="n">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&quot;media&quot;</span><span class="p">)</span>
+    <span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">findall</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+        <span class="n">data_files</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">&#39;media/invariant_media&#39;</span><span class="p">,</span> <span class="p">[</span><span class="n">f</span><span class="p">]))</span>
+    <span class="k">return</span> <span class="n">data_files</span></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../index.html" >Module code</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/invariant/help_panel.html
===================================================================
--- _modules/sas/perspectives/invariant/help_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/invariant/help_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,232 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.invariant.help_panel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.invariant" href="../invariant.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" accesskey="U">sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.invariant.help_panel</h1><div class="highlight"><pre>
+<span class="c">#!/usr/bin/python</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">wx.html</span> <span class="kn">as</span> <span class="nn">html</span>
+<span class="kn">from</span> <span class="nn">wx.lib.splitter</span> <span class="kn">import</span> <span class="n">MultiSplitterWindow</span>
+<span class="kn">import</span> <span class="nn">os</span>
+
+    
+<div class="viewcode-block" id="HelpDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.help_panel.HelpDialog">[docs]</a><span class="k">class</span> <span class="nc">HelpDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">400</span><span class="p">,</span> <span class="mi">420</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="s">&quot;Invariant help&quot;</span><span class="p">)</span> 
+        
+        <span class="n">vbox</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>
+
+        <span class="n">explanation</span> <span class="o">=</span> <span class="n">help</span><span class="p">()</span>
+           
+        <span class="n">label_explain</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">explanation</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">350</span><span class="p">,</span> <span class="mi">320</span><span class="p">))</span>
+            
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_explain</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+
+
+        <span class="n">static_line</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">static_line</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">EXPAND</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        
+        <span class="n">button_OK</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">,</span> <span class="s">&quot;OK&quot;</span><span class="p">)</span>
+
+        <span class="n">sizer_button</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>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_OK</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>       
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_button</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="HelpWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.help_panel.HelpWindow">[docs]</a><span class="k">class</span> <span class="nc">HelpWindow</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span> <span class="s">&#39;HelpWindow&#39;</span><span class="p">,</span> <span class="n">pageToOpen</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">820</span><span class="p">,</span> <span class="mi">450</span><span class="p">))</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        contains help info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="s">&quot;Invariant Help&quot;</span><span class="p">)</span> 
+        <span class="n">splitter</span> <span class="o">=</span> <span class="n">MultiSplitterWindow</span><span class="p">(</span><span class="bp">self</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">SP_LIVE_UPDATE</span><span class="p">)</span>
+        <span class="n">rpanel</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">splitter</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">lpanel</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">splitter</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">BORDER_SUNKEN</span><span class="p">)</span>
+        
+        <span class="n">vbox</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>
+        <span class="n">header</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">rpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">header</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;#6666FF&#39;</span><span class="p">)</span>
+        <span class="n">header</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;WHITE&#39;</span><span class="p">)</span>
+        <span class="n">hbox</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>
+        <span class="n">st</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">header</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Contents&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="n">font</span> <span class="o">=</span> <span class="n">st</span><span class="o">.</span><span class="n">GetFont</span><span class="p">()</span>
+        <span class="n">font</span><span class="o">.</span><span class="n">SetPointSize</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">st</span><span class="o">.</span><span class="n">SetFont</span><span class="p">(</span><span class="n">font</span><span class="p">)</span>
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">st</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">header</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">hbox</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">header</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">EXPAND</span><span class="p">)</span>
+       
+        <span class="n">vboxl</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>
+        <span class="n">headerl</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">lpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+       
+        <span class="n">headerl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&#39;#6666FF&#39;</span><span class="p">)</span>
+        <span class="n">headerl</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;WHITE&#39;</span><span class="p">)</span>
+        <span class="n">hboxl</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>
+        <span class="n">lst</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="n">headerl</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Menu&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
+        <span class="n">fontl</span> <span class="o">=</span> <span class="n">lst</span><span class="o">.</span><span class="n">GetFont</span><span class="p">()</span>
+        <span class="n">fontl</span><span class="o">.</span><span class="n">SetPointSize</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
+        <span class="n">lst</span><span class="o">.</span><span class="n">SetFont</span><span class="p">(</span><span class="n">fontl</span><span class="p">)</span>
+        <span class="n">hboxl</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">lst</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">headerl</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">hboxl</span><span class="p">)</span>
+        <span class="n">vboxl</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">headerl</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">EXPAND</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lhelp</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlWindow</span><span class="p">(</span><span class="n">lpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">NO_BORDER</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlWindow</span><span class="p">(</span><span class="n">rpanel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">NO_BORDER</span><span class="p">,</span> 
+                                     <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">500</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="kn">import</span> <span class="nn">sas.perspectives.invariant</span> <span class="kn">as</span> <span class="nn">invariant</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">invariant</span><span class="o">.</span><span class="n">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&#39;media&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">path</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span><span class="s">&quot;invariant_help.html&quot;</span><span class="p">)</span>
+     
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">LoadPage</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">page</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;&lt;html&gt;</span>
+<span class="s">            &lt;body&gt;</span>
+<span class="s">            &lt;ul&gt;</span>
+<span class="s">            &lt;li&gt;&lt;a href =&quot;</span><span class="si">%s</span><span class="s">&quot; target =&quot;showframe&quot;&gt;Invariant&lt;/a&gt;&lt;br&gt;&lt;/li&gt;</span>
+<span class="s">            &lt;/ul&gt;</span>
+<span class="s">            &lt;/body&gt;</span>
+<span class="s">            &lt;/html&gt;&quot;&quot;&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">path</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">lhelp</span><span class="o">.</span><span class="n">SetPage</span><span class="p">(</span><span class="n">page</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">lhelp</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">html</span><span class="o">.</span><span class="n">EVT_HTML_LINK_CLICKED</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">OnLinkClicked</span><span class="p">)</span>
+        
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+        <span class="n">vboxl</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">lhelp</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+        <span class="n">rpanel</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="n">lpanel</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vboxl</span><span class="p">)</span>
+        <span class="n">lpanel</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        
+        <span class="n">vbox1</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>
+        <span class="n">vbox1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">splitter</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">)</span>
+        <span class="n">splitter</span><span class="o">.</span><span class="n">AppendWindow</span><span class="p">(</span><span class="n">lpanel</span><span class="p">,</span> <span class="mi">200</span><span class="p">)</span>
+        <span class="n">splitter</span><span class="o">.</span><span class="n">AppendWindow</span><span class="p">(</span><span class="n">rpanel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox1</span><span class="p">)</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+        
+<div class="viewcode-block" id="HelpWindow.OnLinkClicked"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.help_panel.HelpWindow.OnLinkClicked">[docs]</a>    <span class="k">def</span> <span class="nf">OnLinkClicked</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Function to diplay html page related to the hyperlinktext selected</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rhelp</span><span class="o">.</span><span class="n">LoadPage</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
+</div></div>
+<div class="viewcode-block" id="ViewApp"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.help_panel.ViewApp">[docs]</a><span class="k">class</span> <span class="nc">ViewApp</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+<div class="viewcode-block" id="ViewApp.OnInit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.help_panel.ViewApp.OnInit">[docs]</a>    <span class="k">def</span> <span class="nf">OnInit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">HelpWindow</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;HelpWindow&#39;</span><span class="p">)</span>    
+        <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTopWindow</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+        
+        <span class="k">return</span> <span class="bp">True</span>
+        
+</div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="n">app</span> <span class="o">=</span> <span class="n">ViewApp</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>     
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" >sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/invariant/invariant.html
===================================================================
--- _modules/sas/perspectives/invariant/invariant.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/invariant/invariant.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,472 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.invariant.invariant &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.invariant" href="../invariant.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" accesskey="U">sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.invariant.invariant</h1><div class="highlight"><pre>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation. </span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+
+
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">copy</span>
+<span class="kn">import</span> <span class="nn">logging</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.gui_manager</span> <span class="kn">import</span> <span class="n">MDIFrame</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">Data1D</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">NewPlotEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.gui_style</span> <span class="kn">import</span> <span class="n">GUIFRAME_ID</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.invariant.invariant_state</span> <span class="kn">import</span> <span class="n">Reader</span> <span class="k">as</span> <span class="n">reader</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.loader</span> <span class="kn">import</span> <span class="n">Loader</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.invariant.invariant_panel</span> <span class="kn">import</span> <span class="n">InvariantPanel</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.plugin_base</span> <span class="kn">import</span> <span class="n">PluginBase</span>
+
+<span class="k">class</span> <span class="nc">Plugin</span><span class="p">(</span><span class="n">PluginBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    This class defines the interface for invariant Plugin class</span>
+<div class="viewcode-block" id="Plugin"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin">[docs]</a><span class="sd">    that can be used by the gui_manager.       </span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">standalone</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="n">PluginBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&quot;Invariant&quot;</span><span class="p">,</span> <span class="n">standalone</span><span class="o">=</span><span class="n">standalone</span><span class="p">)</span>
+        
+        <span class="c">#dictionary containing data name and error on dy of that data </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">err_dy</span> <span class="o">=</span> <span class="p">{}</span>
+       
+        <span class="c">#default state objects</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_reader</span> <span class="o">=</span> <span class="bp">None</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">_extensions</span> <span class="o">=</span> <span class="s">&#39;.inv&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span> <span class="o">=</span> <span class="bp">None</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">__data</span> <span class="o">=</span> <span class="bp">None</span> 
+       
+        <span class="c"># Log startup</span>
+        <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Invariant plug-in started&quot;</span><span class="p">)</span>
+       
+    <span class="k">def</span> <span class="nf">help</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show a general help dialog. </span>
+<div class="viewcode-block" id="Plugin.help"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.help">[docs]</a><span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">help_panel</span> <span class="kn">import</span>  <span class="n">HelpWindow</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">HelpWindow</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> 
+        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">frame</span><span class="p">,</span> <span class="s">&quot;IsIconized&quot;</span><span class="p">):</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">frame</span><span class="o">.</span><span class="n">IsIconized</span><span class="p">():</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">icon</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">GetIcon</span><span class="p">()</span>
+                    <span class="n">frame</span><span class="o">.</span><span class="n">SetIcon</span><span class="p">(</span><span class="n">icon</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>  
+        <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="Plugin.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.get_data">[docs]</a>        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span>
+    
+    <span class="k">def</span> <span class="nf">get_panels</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create and return the list of wx.Panels for your plug-in.</span></div>
+<div class="viewcode-block" id="Plugin.get_panels"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.get_panels">[docs]</a><span class="sd">        Define the plug-in perspective.</span>
+<span class="sd">        </span>
+<span class="sd">        Panels should inherit from DefaultPanel defined below,</span>
+<span class="sd">        or should present the same interface. They must define</span>
+<span class="sd">        &quot;window_caption&quot; and &quot;window_name&quot;.</span>
+<span class="sd">        </span>
+<span class="sd">        :param parent: parent window</span>
+<span class="sd">        </span>
+<span class="sd">        :return: list of panels</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Save a reference to the parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">frame</span> <span class="o">=</span> <span class="n">MDIFrame</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;None&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">200</span><span class="p">))</span>     
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span> <span class="o">=</span> <span class="n">InvariantPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">frame</span><span class="p">)</span>        
+        <span class="bp">self</span><span class="o">.</span><span class="n">frame</span><span class="o">.</span><span class="n">set_panel</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_frame_set_helper</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="n">manager</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">perspective</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">window_name</span><span class="p">)</span>  
+        <span class="c">#Create reader when fitting panel are created</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_reader</span> <span class="o">=</span> <span class="n">reader</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">set_state</span><span class="p">)</span>   
+        <span class="c">#append that reader to list of available reader </span>
+        <span class="n">loader</span> <span class="o">=</span> <span class="n">Loader</span><span class="p">()</span>
+        <span class="n">loader</span><span class="o">.</span><span class="n">associate_file_reader</span><span class="p">(</span><span class="s">&quot;.inv&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_reader</span><span class="p">)</span>
+        <span class="c">#loader.associate_file_reader(&quot;.svs&quot;, self.state_reader)</span>
+        <span class="c"># Return the list of panels</span>
+        <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="p">]</span>
+  
+    <span class="k">def</span> <span class="nf">get_context_menu</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">plotpanel</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        This method is optional.</span></div>
+<div class="viewcode-block" id="Plugin.get_context_menu"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.get_context_menu">[docs]</a><span class="sd">    </span>
+<span class="sd">        When the context menu of a plot is rendered, the </span>
+<span class="sd">        get_context_menu method will be called to give you a </span>
+<span class="sd">        chance to add a menu item to the context menu.</span>
+<span class="sd">        </span>
+<span class="sd">        A ref to a Graph object is passed so that you can</span>
+<span class="sd">        investigate the plot content and decide whether you</span>
+<span class="sd">        need to add items to the context menu.  </span>
+<span class="sd">        </span>
+<span class="sd">        This method returns a list of menu items.</span>
+<span class="sd">        Each item is itself a list defining the text to </span>
+<span class="sd">        appear in the menu, a tool-tip help text, and a</span>
+<span class="sd">        call-back method.</span>
+<span class="sd">        </span>
+<span class="sd">        :param graph: the Graph object to which we attach the context menu</span>
+<span class="sd">        </span>
+<span class="sd">        :return: a list of menu items with call-back function</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">graph</span> <span class="o">=</span> <span class="n">plotpanel</span><span class="o">.</span><span class="n">graph</span>
+        <span class="n">invariant_option</span> <span class="o">=</span> <span class="s">&quot;Compute invariant&quot;</span>
+        <span class="n">invariant_hint</span> <span class="o">=</span> <span class="s">&quot;Will displays the invariant panel for&quot;</span>
+        <span class="n">invariant_hint</span> <span class="o">+=</span> <span class="s">&quot; further computation&quot;</span>
+        
+        <span class="k">if</span> <span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">plotpanel</span><span class="o">.</span><span class="n">plots</span><span class="p">:</span>
+            <span class="k">return</span> <span class="p">[]</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="n">plotpanel</span><span class="o">.</span><span class="n">plots</span><span class="p">[</span><span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span><span class="p">]</span>
+        
+        <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">):</span>
+           <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">name</span> <span class="o">!=</span> <span class="s">&quot;$I_{obs}(q)$&quot;</span> <span class="ow">and</span>  <span class="n">data</span><span class="o">.</span><span class="n">name</span> <span class="o">!=</span> <span class="s">&quot; $P_{fit}(r)$&quot;</span><span class="p">:</span>
+               <span class="k">return</span> <span class="p">[[</span><span class="n">invariant_option</span><span class="p">,</span> <span class="n">invariant_hint</span><span class="p">,</span> 
+                                        <span class="bp">self</span><span class="o">.</span><span class="n">_compute_invariant</span><span class="p">]]</span>
+        <span class="k">return</span> <span class="p">[]</span>
+
+    <span class="k">def</span> <span class="nf">_compute_invariant</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>    
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Open the invariant panel to invariant computation</span></div>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">Plugin</span><span class="o">.</span><span class="n">on_perspective</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">plots</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">):</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Invariant use only Data1D got: [</span><span class="si">%s</span><span class="s">] &quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">msg</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_helper</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
+                
+    <span class="k">def</span> <span class="nf">set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        receive a list of data and compute invariant</span>
+<div class="viewcode-block" id="Plugin.set_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.set_data">[docs]</a><span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">data_list</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">data_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">data_1d_list</span> <span class="o">=</span> <span class="p">[]</span>
+                <span class="n">data_2d_list</span> <span class="o">=</span> <span class="p">[]</span>
+                <span class="n">error_msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+                <span class="c"># separate data into data1d and data2d list</span>
+                <span class="k">for</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">data_list</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">):</span>
+                            <span class="n">data_1d_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="n">error_msg</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s">  type </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">),</span>
+                                             <span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">))</span>
+                            <span class="n">data_2d_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_2d_list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Invariant does not support the following data types:</span><span class="se">\n</span><span class="s">&quot;</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="n">error_msg</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_1d_list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                    <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;error&#39;</span><span class="p">))</span>
+                    <span class="k">return</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Invariant panel does not allow multiple data!</span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Please select one.</span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                    <span class="kn">from</span> <span class="nn">invariant_widgets</span> <span class="kn">import</span> <span class="n">DataDialog</span>
+                    <span class="n">dlg</span> <span class="o">=</span> <span class="n">DataDialog</span><span class="p">(</span><span class="n">data_list</span><span class="o">=</span><span class="n">data_1d_list</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="n">msg</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+                        <span class="n">data</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>
+                    <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+
+            <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;invariant receives no data. </span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;error&#39;</span><span class="p">))</span>
+                <span class="k">return</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">):</span>
+                 <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;invariant cannot be computed for data of &quot;</span>
+                 <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;type </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+                 <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;error&#39;</span><span class="p">))</span>
+                 <span class="k">return</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">data</span><span class="p">,</span>
+                                           <span class="n">title</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">title</span><span class="p">))</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">compute_helper</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Invariant Set_data: &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                                <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>    
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;invariant cannot be computed for data of &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;type </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;error&#39;</span><span class="p">))</span>
+    <span class="k">def</span> <span class="nf">delete_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="Plugin.delete_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.delete_data">[docs]</a>        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="k">for</span> <span class="nb">id</span> <span class="ow">in</span> <span class="n">data_id</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">id</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">id</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">clear_panel</span><span class="p">()</span>
+                
+    <span class="k">def</span> <span class="nf">clear_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="Plugin.clear_panel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.clear_panel">[docs]</a>        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">clear_panel</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">compute_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span></div>
+<div class="viewcode-block" id="Plugin.compute_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.compute_helper">[docs]</a>        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span> 
+        <span class="c"># set current data if not it&#39;s a state data</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">is_state_data</span><span class="p">:</span>
+            <span class="c"># Store reference to data</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">__data</span> <span class="o">=</span> <span class="n">data</span>
+            <span class="c"># Set the data set to be user for invariant calculation</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
+           
+    <span class="k">def</span> <span class="nf">save_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filepath</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Save data in provided state object.</span></div>
+<div class="viewcode-block" id="Plugin.save_file"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.save_file">[docs]</a><span class="sd">                </span>
+<span class="sd">        :param filepath: path of file to write to</span>
+<span class="sd">        :param state: invariant state </span>
+<span class="sd">        &quot;&quot;&quot;</span>     
+        <span class="c"># Write the state to file</span>
+        <span class="c"># First, check that the data is of the right type</span>
+        <span class="n">current_plottable</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span>
+
+        <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">current_plottable</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state_reader</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">filepath</span><span class="p">,</span> <span class="n">current_plottable</span><span class="p">,</span> <span class="n">state</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;invariant.save_file: the data being saved is&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; not a sas.dataloader.data_info.Data1D object&quot;</span> 
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">msg</span>
+
+    <span class="k">def</span> <span class="nf">set_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>    
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Call-back method for the state reader.</span></div>
+<div class="viewcode-block" id="Plugin.set_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.set_state">[docs]</a><span class="sd">        This method is called when a .inv/.svs file is loaded.</span>
+<span class="sd">        </span>
+<span class="sd">        :param state: State object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;list&#39;</span><span class="p">:</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">datainfo</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">datainfo</span>
+            <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;invariant.set_state: datainfo parameter cannot&quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; be None in standalone mode&quot;</span>
+                <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">msg</span>
+            <span class="c"># Make sure the user sees the invariant panel after loading</span>
+            <span class="c">#self.parent.set_perspective(self.perspective)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">on_perspective</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;invstate&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">file</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;invstate&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="n">name</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="n">name</span>
+
+            <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">create_gui_data</span><span class="p">(</span><span class="n">data</span><span class="p">,</span><span class="bp">None</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">__data</span> <span class="o">=</span> <span class="n">data</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="p">,</span>
+                                        <span class="n">reset</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">title</span><span class="p">))</span>
+            <span class="n">data_dict</span> <span class="o">=</span> <span class="p">{</span><span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">id</span><span class="p">:</span><span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="p">}</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="n">data_list</span><span class="o">=</span><span class="n">data_dict</span><span class="p">)</span>
+            <span class="c"># set state</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">is_state_data</span> <span class="o">=</span> <span class="bp">True</span>
+            
+            <span class="c"># Load the invariant states</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span> <span class="o">=</span> <span class="n">state</span>
+            <span class="c"># Requires to have self.__data and self.temp_state  first.</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">on_set_state_helper</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+
+        <span class="k">except</span><span class="p">:</span> 
+            <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;invariant.set_state: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+            
+    <span class="k">def</span> <span class="nf">on_set_state_helper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the state when called by EVT_STATE_UPDATE event from guiframe</span></div>
+<div class="viewcode-block" id="Plugin.on_set_state_helper"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.on_set_state_helper">[docs]</a><span class="sd">        after a .inv/.svs file is loaded </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">set_state</span><span class="p">(</span><span class="n">state</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span><span class="p">,</span>
+                                       <span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">temp_state</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        
+    <span class="k">def</span> <span class="nf">plot_theory</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Receive a data set and post a NewPlotEvent to parent.</span></div>
+<div class="viewcode-block" id="Plugin.plot_theory"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.plot_theory">[docs]</a><span class="sd">        </span>
+<span class="sd">        :param data: extrapolated data to be plotted</span>
+<span class="sd">        :param name: Data&#39;s name to use for the legend</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#import copy</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="nb">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">id</span><span class="p">)</span> <span class="o">+</span> <span class="n">name</span>
+            <span class="n">group_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">group_id</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">,</span>
+                                               <span class="n">group_id</span><span class="o">=</span><span class="n">group_id</span><span class="p">,</span>
+                                               <span class="n">action</span><span class="o">=</span><span class="s">&#39;Remove&#39;</span><span class="p">))</span>
+            <span class="k">return</span>
+    
+        <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="p">[],</span> <span class="n">y</span><span class="o">=</span><span class="p">[],</span> <span class="n">dy</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+        <span class="n">scale</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">get_scale</span><span class="p">()</span>
+        <span class="n">background</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">get_background</span><span class="p">()</span>
+        
+        <span class="k">if</span> <span class="n">scale</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="c"># Put back the sacle and bkg for plotting</span>
+            <span class="n">data</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">y</span> <span class="o">+</span> <span class="n">background</span><span class="p">)</span><span class="o">/</span><span class="n">scale</span>
+            <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">y</span><span class="p">,</span> <span class="n">dy</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Scale can not be zero.&quot;</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">msg</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">new_plot</span><span class="o">.</span><span class="n">x</span><span class="p">)</span><span class="o">==</span> <span class="mi">0</span> <span class="p">:</span>
+            <span class="k">return</span>
+        
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">_xaxis</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">_xunit</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">_yaxis</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">_yunit</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">group_id</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">id</span><span class="p">)</span> <span class="o">+</span> <span class="n">name</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">title</span>
+        <span class="c"># Save theory_data in a state</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">name_head</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;-&#39;</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">name_head</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;Low&#39;</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">theory_lowQ</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">new_plot</span><span class="p">)</span>
+            <span class="k">elif</span> <span class="n">name_head</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;High&#39;</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">theory_highQ</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">new_plot</span><span class="p">)</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                               <span class="n">title</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">title</span><span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">plot_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">scale</span><span class="p">,</span> <span class="n">background</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        replot the current data if the user enters a new scale or background</span></div>
+<div class="viewcode-block" id="Plugin.plot_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant.Plugin.plot_data">[docs]</a><span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">new_plot</span> <span class="o">=</span> <span class="n">scale</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span> <span class="o">-</span> <span class="n">background</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">name</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">group_id</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">id</span> 
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__data</span><span class="o">.</span><span class="n">title</span>
+       
+        <span class="c"># Save data in a state: but seems to never happen </span>
+        <span class="k">if</span> <span class="n">new_plot</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">invariant_panel</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">data</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">new_plot</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                               <span class="n">title</span><span class="o">=</span><span class="n">new_plot</span><span class="o">.</span><span class="n">title</span><span class="p">))</span>
+        
+</pre></div></div></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" >sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/invariant/invariant_details.html
===================================================================
--- _modules/sas/perspectives/invariant/invariant_details.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/invariant/invariant_details.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,639 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.invariant.invariant_details &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.invariant" href="../invariant.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" accesskey="U">sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.invariant.invariant_details</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Invariant panel</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">format_number</span>
+<span class="kn">from</span> <span class="nn">invariant_widgets</span> <span class="kn">import</span> <span class="n">OutputTextCtrl</span>
+<span class="c"># Dimensions related to chart</span>
+<span class="n">RECTANGLE_WIDTH</span>  <span class="o">=</span> <span class="mf">400.0</span>  
+<span class="n">RECTANGLE_HEIGHT</span> <span class="o">=</span> <span class="mi">20</span>
+<span class="c">#Invariant panel size </span>
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">76</span>
+
+<span class="c">#scale to use for a bar of value zero</span>
+<span class="n">RECTANGLE_SCALE</span>  <span class="o">=</span> <span class="mf">0.0001</span>
+<span class="n">DEFAULT_QSTAR</span> <span class="o">=</span> <span class="mf">1.0</span>  
+  
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">450</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">430</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">480</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">530</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">430</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    
+<span class="n">ERROR_COLOR</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Colour</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span>  <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">128</span><span class="p">)</span>
+<span class="n">EXTRAPOLATION_COLOR</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Colour</span><span class="p">(</span><span class="mi">169</span><span class="p">,</span>  <span class="mi">169</span><span class="p">,</span> <span class="mi">168</span><span class="p">,</span> <span class="mi">128</span><span class="p">)</span>
+<span class="n">INVARIANT_COLOR</span> <span class="o">=</span>  <span class="n">wx</span><span class="o">.</span><span class="n">Colour</span><span class="p">(</span><span class="mi">67</span><span class="p">,</span>  <span class="mi">208</span><span class="p">,</span>  <span class="mi">128</span><span class="p">,</span> <span class="mi">128</span><span class="p">)</span>    
+  
+  
+<div class="viewcode-block" id="InvariantContainer"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_details.InvariantContainer">[docs]</a><span class="k">class</span> <span class="nc">InvariantContainer</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Object</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    This class stores some values resulting resulting from invariant</span>
+<span class="sd">    calculations. Given the value of total invariant, this class can also </span>
+<span class="sd">    determine the percentage of invariants resulting from extrapolation.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="c">#invariant at low range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#invariant at low range error</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_err</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#invariant </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#invariant error</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar_err</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#invariant at high range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#invariant at high range error</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_err</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#invariant total</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar_total</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#invariant error</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar_total_err</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#scale</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_percent</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_percent</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar_percent</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># warning message</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">=</span> <span class="s">&quot;No Details on calculations available...</span><span class="se">\n</span><span class="s">&quot;</span>
+        
+<div class="viewcode-block" id="InvariantContainer.compute_percentage"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_details.InvariantContainer.compute_percentage">[docs]</a>    <span class="k">def</span> <span class="nf">compute_percentage</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Compute percentage of each invariant</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_total</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qstar_percent</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">check_values</span><span class="p">()</span>
+            <span class="k">return</span> 
+        
+        <span class="c">#compute invariant percentage</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qstar_percent</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qstar_percent</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar</span><span class="p">)</span><span class="o">/</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_total</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qstar_percent</span> <span class="o">=</span> <span class="s">&#39;error&#39;</span>
+        <span class="c">#compute low q invariant percentage</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_percent</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_percent</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_low</span><span class="p">)</span>\
+                                            <span class="o">/</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_total</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_percent</span> <span class="o">=</span> <span class="s">&#39;error&#39;</span>
+        <span class="c">#compute high q invariant percentage</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_percent</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_percent</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_high</span><span class="p">)</span>\
+                                                <span class="o">/</span><span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_total</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_percent</span> <span class="o">=</span> <span class="s">&#39;error&#39;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">check_values</span><span class="p">)</span>
+   </div>
+<div class="viewcode-block" id="InvariantContainer.check_values"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_details.InvariantContainer.check_values">[docs]</a>    <span class="k">def</span> <span class="nf">check_values</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        check the validity if invariant</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_total</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">=</span> <span class="s">&quot;Invariant not calculated.</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="k">return</span> 
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_total</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">=</span> <span class="s">&quot;Invariant is zero. </span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">+=</span> <span class="s">&quot;The calculations are likely &quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">+=</span> <span class="s">&quot;to be unreliable!</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="k">return</span> 
+        <span class="c">#warning to the user when the extrapolated invariant is greater than %5</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_percent</span> <span class="o">==</span> <span class="s">&#39;error&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&#39;Error occurred when computing invariant from data.</span><span class="se">\n</span><span class="s"> &#39;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_percent</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Invariant Q  contribution is greater &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;than 100% .</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_percent</span> <span class="o">==</span> <span class="s">&#39;error&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_low</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Error occurred when computing extrapolated invariant&quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; at low-Q region.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_percent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_percent</span> <span class="o">&gt;=</span> <span class="mf">0.05</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Extrapolated contribution at Low Q is higher &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;than 5</span><span class="si">% o</span><span class="s">f the invariant.</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_percent</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Extrapolated contribution at Low Q &lt; 0.</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_percent</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Extrapolated contribution at Low Q is greater &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;than 100% .</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_percent</span> <span class="o">==</span> <span class="s">&#39;error&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_high</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&#39;Error occurred when computing extrapolated&#39;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&#39; invariant at high-Q region.</span><span class="se">\n</span><span class="s">&#39;</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_percent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_percent</span> <span class="o">&gt;=</span> <span class="mf">0.05</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Extrapolated contribution at High Q is higher &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;than 5</span><span class="si">% o</span><span class="s">f the invariant.</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_percent</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Extrapolated contribution at High Q &lt; 0.</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_percent</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Extrapolated contribution at High Q is greater &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;than 100% .</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="k">if</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_percent</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="bp">None</span><span class="p">,</span> <span class="s">&quot;error&quot;</span><span class="p">])</span> <span class="ow">and</span> \
+            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_percent</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="bp">None</span><span class="p">,</span> <span class="s">&quot;error&quot;</span><span class="p">])</span>\
+            <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_low_percent</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_high_percent</span> <span class="o">&gt;=</span> <span class="mf">0.05</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span> <span class="o">=</span> <span class="bp">True</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;The sum of all extrapolated contributions is higher &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;than 5</span><span class="si">% o</span><span class="s">f the invariant.</span><span class="se">\n</span><span class="s">&quot;</span>
+            
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">existing_warning</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">+=</span> <span class="n">msg</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">+=</span> <span class="s">&quot;The calculations are likely to be&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">+=</span> <span class="s">&quot; unreliable!</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">=</span> <span class="s">&quot;No Details on calculations available...</span><span class="se">\n</span><span class="s">&quot;</span>
+            </div></div>
+<div class="viewcode-block" id="InvariantDetailsPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_details.InvariantDetailsPanel">[docs]</a><span class="k">class</span> <span class="nc">InvariantDetailsPanel</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    This panel describes proportion of invariants </span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">qstar_container</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                                    <span class="n">title</span><span class="o">=</span><span class="s">&quot;Invariant Details&quot;</span><span class="p">,</span>
+                                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">)):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
+        
+        <span class="c">#Font size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="c">#self.qstar_container</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span> <span class="o">=</span> <span class="n">qstar_container</span>
+        <span class="c">#warning message</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span><span class="o">.</span><span class="n">warning_msg</span>
+   
+        <span class="c">#Define scale of each bar</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_inv_percent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span><span class="o">.</span><span class="n">qstar_low_percent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_scale</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_scale</span><span class="p">(</span><span class="n">percentage</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">low_inv_percent</span><span class="p">,</span>
+                                         <span class="n">scale_name</span><span class="o">=</span><span class="s">&quot;Extrapolated at Low Q&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">inv_percent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span><span class="o">.</span><span class="n">qstar_percent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">inv_scale</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_scale</span><span class="p">(</span><span class="n">percentage</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">inv_percent</span><span class="p">,</span> 
+                                            <span class="n">scale_name</span><span class="o">=</span><span class="s">&quot;Inv in Q range&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_inv_percent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span><span class="o">.</span><span class="n">qstar_high_percent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_scale</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_scale</span><span class="p">(</span><span class="n">percentage</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">high_inv_percent</span><span class="p">,</span>
+                                         <span class="n">scale_name</span><span class="o">=</span><span class="s">&quot;Extrapolated at High Q&quot;</span><span class="p">)</span>
+       
+        <span class="c">#Default color the extrapolation bar is grey</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_color_low</span> <span class="o">=</span> <span class="n">EXTRAPOLATION_COLOR</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_color_high</span> <span class="o">=</span> <span class="n">EXTRAPOLATION_COLOR</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_color</span> <span class="o">=</span> <span class="n">INVARIANT_COLOR</span>
+        <span class="c">#change color of high and low bar when necessary</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_color_bar</span><span class="p">()</span>
+        <span class="c">#draw the panel itself</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_values</span><span class="p">()</span>
+  
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Define main sizers needed for this panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Box sizers must be defined first before defining buttons/textctrls</span>
+        <span class="c"># (MAC).</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="c">#Sizer related to chart</span>
+        <span class="n">chart_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Invariant Chart&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">chart_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">chart_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">chart_sizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WIDTH</span> <span class="o">-</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">110</span><span class="p">))</span>
+        <span class="c">#Sizer related to invariant values</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span> <span class="o">=</span>  <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
+        <span class="n">invariant_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Numerical Values&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_box_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">invariant_box</span><span class="p">,</span>
+                                                      <span class="n">wx</span><span class="o">.</span><span class="n">HORIZONTAL</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_box_sizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WIDTH</span> <span class="o">-</span> <span class="mi">50</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="c">#Sizer related to warning message</span>
+        <span class="n">warning_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Warning&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">warning_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">warning_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">warning_sizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">PANEL_WIDTH</span><span class="o">-</span><span class="mi">50</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="c">#Sizer related to button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+      
+    <span class="k">def</span> <span class="nf">_layout_shart</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to chart</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel_chart</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="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel_chart</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_PAINT</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_paint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">chart_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">panel_chart</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_invariant</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to invariant</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">uncertainty</span> <span class="o">=</span> <span class="s">&quot;+/-&quot;</span> 
+        <span class="n">unit_invariant</span> <span class="o">=</span> <span class="s">&#39;[1/(cm * A^3)]&#39;</span>
+     
+        <span class="n">invariant_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Q* from Data &#39;</span><span class="p">)</span>
+        <span class="n">invariant_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Invariant in the data set&#39;s Q range.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Invariant in the data set&#39;s Q range.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_err_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Uncertainty on the invariant from data&#39;s range.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_err_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="n">invariant_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_invariant</span><span class="p">)</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Unit of the invariant from data&#39;s Q range&quot;</span>
+        <span class="n">invariant_units_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+       
+        <span class="n">invariant_low_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Q* from Low-Q&#39;</span><span class="p">)</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Extrapolated invariant from low-Q range.&quot;</span>
+        <span class="n">invariant_low_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_low_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Extrapolated invariant from low-Q range.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_low_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_low_err_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Uncertainty on the invariant from low-Q range.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_low_err_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="n">invariant_low_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_invariant</span><span class="p">)</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Unit of the extrapolated invariant from  low-Q range&quot;</span>
+        <span class="n">invariant_low_units_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        
+        <span class="n">invariant_high_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Q* from High-Q&#39;</span><span class="p">)</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Extrapolated invariant from  high-Q range&quot;</span>
+        <span class="n">invariant_high_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_high_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                 <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Extrapolated invariant from  high-Q range&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_high_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_high_err_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                     <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Uncertainty on the invariant from high-Q range.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_high_err_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="n">invariant_high_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_invariant</span><span class="p">)</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Unit of the extrapolated invariant from  high-Q range&quot;</span>
+        <span class="n">invariant_high_units_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+   
+        <span class="c">#Invariant low</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">invariant_low_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_low_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">uncertainty</span><span class="p">),</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_low_err_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">invariant_low_units_txt</span>
+                         <span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>  
+        <span class="c">#Invariant </span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">invariant_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">uncertainty</span><span class="p">),</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_err_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span><span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">invariant_units_txt</span>
+                         <span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>  
+        <span class="c">#Invariant high</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">invariant_high_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_high_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">uncertainty</span><span class="p">),</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_high_err_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">invariant_high_units_txt</span>
+                         <span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_box_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</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">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>  
+       
+    <span class="k">def</span> <span class="nf">_layout_warning</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to warning</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Warning [string]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span><span class="p">)</span>  
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span><span class="o">.</span><span class="n">existing_warning</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg_txt</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&#39;red&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">warning_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">warning_msg_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to button</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Close button</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">button_ok</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Ok&quot;</span><span class="p">)</span>
+        <span class="n">button_ok</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Give Details on Computation&quot;</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</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">LEFT</span><span class="p">,</span> <span class="mi">350</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="n">button_ok</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw window content</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_shart</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_invariant</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_warning</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">chart_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                 <span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">invariant_box_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">warning_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+       
+        
+<div class="viewcode-block" id="InvariantDetailsPanel.set_values"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_details.InvariantDetailsPanel.set_values">[docs]</a>    <span class="k">def</span> <span class="nf">set_values</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set value of txtcrtl</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">value</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span><span class="o">.</span><span class="n">qstar</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+        <span class="n">value</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span><span class="o">.</span><span class="n">qstar_err</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_err_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> 
+        <span class="n">value</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span><span class="o">.</span><span class="n">qstar_low</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_low_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+        <span class="n">value</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span><span class="o">.</span><span class="n">qstar_low_err</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_low_err_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> 
+        <span class="n">value</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span><span class="o">.</span><span class="n">qstar_high</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_high_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+        <span class="n">value</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qstar_container</span><span class="o">.</span><span class="n">qstar_high_err</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_high_err_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> 
+</div>
+<div class="viewcode-block" id="InvariantDetailsPanel.get_scale"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_details.InvariantDetailsPanel.get_scale">[docs]</a>    <span class="k">def</span> <span class="nf">get_scale</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">percentage</span><span class="p">,</span> <span class="n">scale_name</span><span class="o">=</span><span class="s">&#39;scale&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check scale receive in this panel. </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">scale</span> <span class="o">=</span> <span class="n">RECTANGLE_SCALE</span>
+        <span class="k">try</span><span class="p">:</span> 
+            <span class="k">if</span> <span class="n">percentage</span> <span class="ow">in</span> <span class="p">[</span><span class="bp">None</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">,</span> <span class="s">&quot;error&quot;</span><span class="p">]:</span>
+                 <span class="n">scale</span> <span class="o">=</span> <span class="n">RECTANGLE_SCALE</span>
+                 <span class="k">return</span> <span class="n">scale</span>
+            <span class="k">elif</span> <span class="n">percentage</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">scale</span> <span class="o">=</span> <span class="n">RECTANGLE_SCALE</span>
+                <span class="k">return</span> <span class="n">scale</span>
+            <span class="n">scale</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">percentage</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">scale</span> <span class="o">=</span> <span class="n">RECTANGLE_SCALE</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">+=</span> <span class="s">&quot;Recieve an invalid scale for </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">warning_msg</span> <span class="o">+=</span> <span class="s">&quot;check this value : </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">percentage</span><span class="p">)</span>
+        <span class="k">return</span>  <span class="n">scale</span>
+    </div>
+<div class="viewcode-block" id="InvariantDetailsPanel.set_color_bar"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_details.InvariantDetailsPanel.set_color_bar">[docs]</a>    <span class="k">def</span> <span class="nf">set_color_bar</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Change the color for low and high bar when necessary</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_color_low</span> <span class="o">=</span> <span class="n">EXTRAPOLATION_COLOR</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_color_high</span> <span class="o">=</span> <span class="n">EXTRAPOLATION_COLOR</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_color</span> <span class="o">=</span> <span class="n">INVARIANT_COLOR</span>
+        <span class="c">#warning to the user when the extrapolated invariant is greater than %5</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">low_scale</span> <span class="o">&gt;=</span> <span class="mf">0.05</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">low_scale</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">low_scale</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_color_low</span> <span class="o">=</span> <span class="n">ERROR_COLOR</span> 
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">high_scale</span> <span class="o">&gt;=</span> <span class="mf">0.05</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">high_scale</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">high_scale</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_color_high</span> <span class="o">=</span> <span class="n">ERROR_COLOR</span> 
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">inv_scale</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">inv_scale</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">invariant_color</span> <span class="o">=</span> <span class="n">ERROR_COLOR</span>  
+    </div>
+<div class="viewcode-block" id="InvariantDetailsPanel.on_close"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_details.InvariantDetailsPanel.on_close">[docs]</a>    <span class="k">def</span> <span class="nf">on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Close the current window</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Close</span><span class="p">()</span>
+     </div>
+<div class="viewcode-block" id="InvariantDetailsPanel.on_paint"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_details.InvariantDetailsPanel.on_paint">[docs]</a>    <span class="k">def</span> <span class="nf">on_paint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw the chart</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">dc</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">PaintDC</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">panel_chart</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">gc</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GraphicsContext</span><span class="o">.</span><span class="n">Create</span><span class="p">(</span><span class="n">dc</span><span class="p">)</span>
+        <span class="k">except</span> <span class="ne">NotImplementedError</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;This build of wxPython does not support &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;the wx.GraphicsContext family of classes.&quot;</span>
+            <span class="n">dc</span><span class="o">.</span><span class="n">DrawText</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">25</span><span class="p">)</span>
+            <span class="k">return</span>
+        <span class="c">#Start the drawing</span>
+        <span class="n">font</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">SystemSettings</span><span class="o">.</span><span class="n">GetFont</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">SYS_DEFAULT_GUI_FONT</span><span class="p">)</span>
+        <span class="n">font</span><span class="o">.</span><span class="n">SetWeight</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">BOLD</span><span class="p">)</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">SetFont</span><span class="p">(</span><span class="n">font</span><span class="p">)</span>
+        <span class="c"># Draw a rectangle</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">gc</span><span class="o">.</span><span class="n">CreatePath</span><span class="p">()</span>
+        <span class="n">path</span><span class="o">.</span><span class="n">AddRectangle</span><span class="p">(</span><span class="o">-</span><span class="n">RECTANGLE_WIDTH</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span><span class="o">-</span><span class="n">RECTANGLE_HEIGHT</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span>
+                          <span class="n">RECTANGLE_WIDTH</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span><span class="n">RECTANGLE_HEIGHT</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span>
+        <span class="n">x_origine</span> <span class="o">=</span> <span class="mi">20</span>
+        <span class="n">y_origine</span> <span class="o">=</span> <span class="mi">15</span>
+        <span class="c">#Draw low rectangle</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">PushState</span><span class="p">()</span>        
+        <span class="n">label</span> <span class="o">=</span> <span class="s">&quot;Q* from Low-Q &quot;</span>
+        <span class="n">PathFunc</span> <span class="o">=</span> <span class="n">gc</span><span class="o">.</span><span class="n">DrawPath</span>
+        <span class="n">w</span><span class="p">,</span> <span class="n">h</span> <span class="o">=</span> <span class="n">gc</span><span class="o">.</span><span class="n">GetTextExtent</span><span class="p">(</span><span class="n">label</span><span class="p">)</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">DrawText</span><span class="p">(</span><span class="n">label</span><span class="p">,</span> <span class="n">x_origine</span><span class="p">,</span> <span class="n">y_origine</span><span class="p">)</span>
+        <span class="c">#Translate the rectangle</span>
+        <span class="n">x_center</span> <span class="o">=</span> <span class="n">x_origine</span> <span class="o">+</span> <span class="n">RECTANGLE_WIDTH</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">low_scale</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="n">w</span> <span class="o">+</span><span class="mi">10</span>
+        <span class="n">y_center</span> <span class="o">=</span> <span class="n">y_origine</span> <span class="o">+</span> <span class="n">h</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">Translate</span><span class="p">(</span><span class="n">x_center</span><span class="p">,</span> <span class="n">y_center</span><span class="p">)</span>    
+        <span class="n">gc</span><span class="o">.</span><span class="n">SetPen</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Pen</span><span class="p">(</span><span class="s">&quot;black&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">SetBrush</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Brush</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_color_low</span><span class="p">))</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">low_inv_percent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">low_percent</span> <span class="o">=</span> <span class="s">&#39;Not Computed&#39;</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">low_inv_percent</span> <span class="o">==</span> <span class="s">&#39;error&#39;</span><span class="p">:</span>
+            <span class="n">low_percent</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">low_percent</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">low_inv_percent</span><span class="o">*</span><span class="mi">100</span><span class="p">)</span><span class="o">+</span> <span class="s">&#39;%&#39;</span>
+        <span class="n">x_center</span> <span class="o">=</span> <span class="mi">20</span>
+        <span class="n">y_center</span> <span class="o">=</span> <span class="o">-</span><span class="n">h</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">DrawText</span><span class="p">(</span><span class="n">low_percent</span><span class="p">,</span> <span class="n">x_center</span><span class="p">,</span> <span class="n">y_center</span><span class="p">)</span>
+        <span class="c"># Increase width by self.low_scale</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">Scale</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">low_scale</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">)</span> 
+        <span class="n">PathFunc</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">PopState</span><span class="p">()</span>  
+        <span class="c">#Draw rectangle for invariant   </span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">PushState</span><span class="p">()</span>    <span class="c"># save it again</span>
+        <span class="n">y_origine</span> <span class="o">+=</span> <span class="mi">20</span>         
+        <span class="n">gc</span><span class="o">.</span><span class="n">DrawText</span><span class="p">(</span><span class="s">&quot;Q* from Data &quot;</span><span class="p">,</span> <span class="n">x_origine</span><span class="p">,</span> <span class="n">y_origine</span><span class="p">)</span>
+        <span class="c"># offset to the lower part of the window</span>
+        <span class="n">x_center</span> <span class="o">=</span> <span class="n">x_origine</span> <span class="o">+</span> <span class="n">RECTANGLE_WIDTH</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">inv_scale</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="n">w</span> <span class="o">+</span> <span class="mi">10</span>
+        <span class="n">y_center</span> <span class="o">=</span> <span class="n">y_origine</span> <span class="o">+</span> <span class="n">h</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">Translate</span><span class="p">(</span><span class="n">x_center</span><span class="p">,</span> <span class="n">y_center</span><span class="p">)</span>
+        <span class="c"># 128 == half transparent</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">SetBrush</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Brush</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_color</span><span class="p">))</span> 
+        <span class="c"># Increase width by self.inv_scale</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">inv_percent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">inv_percent</span> <span class="o">=</span> <span class="s">&#39;Not Computed&#39;</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">inv_percent</span> <span class="o">==</span> <span class="s">&#39;error&#39;</span><span class="p">:</span>
+            <span class="n">inv_percent</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">inv_percent</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">inv_percent</span><span class="o">*</span><span class="mi">100</span><span class="p">)</span><span class="o">+</span> <span class="s">&#39;%&#39;</span>
+        <span class="n">x_center</span> <span class="o">=</span> <span class="mi">20</span> 
+        <span class="n">y_center</span> <span class="o">=</span> <span class="o">-</span><span class="n">h</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">DrawText</span><span class="p">(</span><span class="n">inv_percent</span><span class="p">,</span> <span class="n">x_center</span><span class="p">,</span> <span class="n">y_center</span><span class="p">)</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">Scale</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">inv_scale</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">)</span>    
+        <span class="n">gc</span><span class="o">.</span><span class="n">DrawPath</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">PopState</span><span class="p">()</span>
+        <span class="c"># restore saved state</span>
+        <span class="c">#Draw rectangle for high invariant</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">PushState</span><span class="p">()</span> 
+        <span class="n">y_origine</span> <span class="o">+=</span> <span class="mi">20</span> 
+        <span class="n">gc</span><span class="o">.</span><span class="n">DrawText</span><span class="p">(</span><span class="s">&quot;Q* from High-Q &quot;</span><span class="p">,</span> <span class="n">x_origine</span><span class="p">,</span> <span class="n">y_origine</span><span class="p">)</span> 
+        <span class="c">#define the position of the new rectangle</span>
+        <span class="n">x_center</span> <span class="o">=</span> <span class="n">x_origine</span> <span class="o">+</span> <span class="n">RECTANGLE_WIDTH</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">high_scale</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="n">w</span> <span class="o">+</span> <span class="mi">10</span>
+        <span class="n">y_center</span> <span class="o">=</span> <span class="n">y_origine</span> <span class="o">+</span> <span class="n">h</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">Translate</span><span class="p">(</span><span class="n">x_center</span><span class="p">,</span> <span class="n">y_center</span><span class="p">)</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">SetBrush</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Brush</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_color_high</span><span class="p">))</span> 
+        <span class="c"># increase scale by self.high_scale</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">high_inv_percent</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">high_percent</span> <span class="o">=</span> <span class="s">&#39;Not Computed&#39;</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">high_inv_percent</span> <span class="o">==</span> <span class="s">&#39;error&#39;</span><span class="p">:</span>
+            <span class="n">high_percent</span> <span class="o">=</span> <span class="s">&#39;Error&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">high_percent</span> <span class="o">=</span> <span class="n">format_number</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">high_inv_percent</span><span class="o">*</span><span class="mi">100</span><span class="p">)</span><span class="o">+</span> <span class="s">&#39;%&#39;</span>
+        <span class="n">x_center</span> <span class="o">=</span> <span class="mi">20</span>
+        <span class="n">y_center</span> <span class="o">=</span> <span class="o">-</span><span class="n">h</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">DrawText</span><span class="p">(</span><span class="n">high_percent</span><span class="p">,</span> <span class="n">x_center</span><span class="p">,</span> <span class="n">y_center</span><span class="p">)</span>
+       
+        <span class="n">gc</span><span class="o">.</span><span class="n">Scale</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">high_scale</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">)</span>  
+        <span class="n">gc</span><span class="o">.</span><span class="n">DrawPath</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="n">gc</span><span class="o">.</span><span class="n">PopState</span><span class="p">()</span></div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" >sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/invariant/invariant_panel.html
===================================================================
--- _modules/sas/perspectives/invariant/invariant_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/invariant/invariant_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,2039 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.invariant.invariant_panel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.invariant" href="../invariant.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" accesskey="U">sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.invariant.invariant_panel</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">This module provide GUI for the neutron scattering length density calculator</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">copy</span>
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">from</span> <span class="nn">wx.lib.scrolledpanel</span> <span class="kn">import</span> <span class="n">ScrolledPanel</span>
+<span class="kn">from</span> <span class="nn">sas.invariant</span> <span class="kn">import</span> <span class="n">invariant</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">format_number</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">check_float</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">AppendBookmarkEvent</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.invariant.invariant_details</span> <span class="kn">import</span> <span class="n">InvariantDetailsPanel</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.invariant.invariant_details</span> <span class="kn">import</span> <span class="n">InvariantContainer</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.invariant.invariant_widgets</span> <span class="kn">import</span> <span class="n">OutputTextCtrl</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.invariant.invariant_widgets</span> <span class="kn">import</span> <span class="n">InvTextCtrl</span>
+<span class="kn">from</span> <span class="nn">sas.perspectives.invariant.invariant_state</span> <span class="kn">import</span> <span class="n">InvariantState</span> <span class="k">as</span> <span class="n">IState</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span>
+<span class="c"># The minimum q-value to be used when extrapolating</span>
+<span class="n">Q_MINIMUM</span>  <span class="o">=</span> <span class="mf">1e-5</span>
+<span class="c"># The maximum q-value to be used when extrapolating</span>
+<span class="n">Q_MAXIMUM</span>  <span class="o">=</span> <span class="mi">10</span>
+<span class="c"># the ratio of maximum q value/(qmax of data) to plot the theory data</span>
+<span class="n">Q_MAXIMUM_PLOT</span> <span class="o">=</span> <span class="mi">3</span>
+<span class="c"># the number of points to consider during fit</span>
+<span class="n">NPTS</span> <span class="o">=</span> <span class="mi">10</span>
+<span class="c">#Default value for background</span>
+<span class="n">BACKGROUND</span> <span class="o">=</span> <span class="mf">0.0</span>
+<span class="c">#default value for the scale</span>
+<span class="n">SCALE</span> <span class="o">=</span> <span class="mf">1.0</span>
+<span class="c">#default value of the contrast</span>
+<span class="n">CONTRAST</span> <span class="o">=</span> <span class="mf">1.0</span>
+<span class="c">#default value of the power used for power law</span>
+<span class="n">POWER</span> <span class="o">=</span> <span class="mf">4.0</span>
+<span class="c">#Invariant panel size </span>
+<span class="n">_BOX_WIDTH</span> <span class="o">=</span> <span class="mi">76</span>
+
+
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">450</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span> 
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">700</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">490</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">530</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">700</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+
+
+<div class="viewcode-block" id="InvariantPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel">[docs]</a><span class="k">class</span> <span class="nc">InvariantPanel</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Provides the Invariant GUI.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## Internal nickname for the window, used by the AUI manager</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&quot;Invariant&quot;</span>
+    <span class="c">## Name to appear on the window title bar</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;Invariant&quot;</span>
+    <span class="c">## Flag to tell the AUI manager to put this panel in the center pane</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">True</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">manager</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;size&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span> <span class="n">PANEL_HEIGHT</span><span class="p">)</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;style&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">FULL_REPAINT_ON_RESIZE</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        <span class="c">#Font size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        <span class="c">#Object that receive status event</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span><span class="o">.</span><span class="n">parent</span>
+        <span class="c">#plug-in using this panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="n">manager</span> 
+        <span class="c">#Data uses for computation</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_scale</span> <span class="o">=</span> <span class="n">SCALE</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">_background</span> <span class="o">=</span> <span class="n">BACKGROUND</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_bmark</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bookmark_num</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_menu</span><span class="p">()</span>
+        <span class="c">#Init state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_state</span><span class="p">()</span>
+        <span class="c"># default flags for state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">new_state</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_state_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_power_out</span> <span class="o">=</span> <span class="bp">False</span>
+
+        <span class="c">#container of invariant value</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#sizers</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_boxsizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_range_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_input</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">inputs_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_range_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_low_high_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_extrapolation_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_extrapolation_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_q_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_button_sizer</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_txt</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_min_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_max_tcl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#Draw the panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_panel</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_state_list</span><span class="p">()</span>
+        <span class="c">## Default file location for save</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>        
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> \
+                        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_save_location</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+    
+<div class="viewcode-block" id="InvariantPanel.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="InvariantPanel.get_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_state">[docs]</a>    <span class="k">def</span> <span class="nf">get_state</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span>
+    </div>
+<div class="viewcode-block" id="InvariantPanel.set_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.set_data">[docs]</a>    <span class="k">def</span> <span class="nf">set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="c">#edit the panel</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_delete_bookmark_items</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_state_by_num</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+            <span class="n">data_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">name</span>
+            <span class="n">data_qmin</span> <span class="o">=</span> <span class="nb">min</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+            <span class="n">data_qmax</span> <span class="o">=</span> <span class="nb">max</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data_name</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_min_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data_qmin</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">data_max_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data_qmax</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">reset_panel</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">compute_invariant</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">name</span>
+            <span class="c">#Reset the list of states</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">data</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">data</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_reset_state_list</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">True</span>  
+    </div>
+    <span class="k">def</span> <span class="nf">_delete_bookmark_items</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Delete bookmark menu items</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># delete toolbar menu</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">reset_bookmark_menu</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_update_toolbar_helper</span><span class="p">()</span>
+        <span class="c"># delete popUpMenu items</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="o">.</span><span class="n">GetMenuItems</span><span class="p">():</span>
+            <span class="n">pos</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">:</span>
+                <span class="k">continue</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="o">.</span><span class="n">DestroyItem</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                
+<div class="viewcode-block" id="InvariantPanel.set_message"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.set_message">[docs]</a>    <span class="k">def</span> <span class="nf">set_message</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Display warning message if available</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">existing_warning</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Warning! Computations on invariant require your &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;attention.</span><span class="se">\n</span><span class="s">Please click on Details button.&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_txt</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&quot;red&quot;</span><span class="p">)</span>
+    
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                             <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span><span class="n">info</span><span class="o">=</span><span class="s">&quot;warning&quot;</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;For more information, click on Details button.&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_txt</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&quot;black&quot;</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                             <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span><span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_txt</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+       </div>
+<div class="viewcode-block" id="InvariantPanel.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.set_manager">[docs]</a>    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set value for the manager</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="n">manager</span> 
+        </div>
+<div class="viewcode-block" id="InvariantPanel.save_project"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.save_project">[docs]</a>    <span class="k">def</span> <span class="nf">save_project</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">doc</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return an xml node containing state of the panel</span>
+<span class="sd">         that guiframe can write to file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_state</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">new_doc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">state_reader</span><span class="o">.</span><span class="n">write_toXML</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">state</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">new_doc</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">doc</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="s">&quot;firstChild&quot;</span><span class="p">):</span>
+                    <span class="n">child</span> <span class="o">=</span> <span class="n">new_doc</span><span class="o">.</span><span class="n">getElementsByTagName</span><span class="p">(</span><span class="s">&quot;SASentry&quot;</span><span class="p">)</span>
+                    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">child</span><span class="p">:</span>
+                        <span class="n">doc</span><span class="o">.</span><span class="n">firstChild</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">doc</span> <span class="o">=</span> <span class="n">new_doc</span>
+        <span class="k">return</span> <span class="n">doc</span>   
+</div>
+<div class="viewcode-block" id="InvariantPanel.set_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.set_state">[docs]</a>    <span class="k">def</span> <span class="nf">set_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set state when loading it from a .inv/.svs file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        
+        <span class="k">if</span> <span class="n">state</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="n">IState</span><span class="p">()</span>
+        <span class="k">elif</span> <span class="n">state</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="k">return</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">new_state</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">state</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">new_state</span> <span class="o">=</span> <span class="bp">True</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
+                <span class="k">return</span>
+
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="n">new_state</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">name</span>   
+
+            <span class="n">num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span>
+            <span class="k">if</span> <span class="n">num</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_undo_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">num</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_set_redo_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                
+            <span class="c"># get bookmarks</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bookmark_num</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">bookmark_list</span><span class="p">)</span>
+            <span class="n">total_bookmark_num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">bookmark_num</span> <span class="o">+</span> <span class="mi">1</span>
+
+            <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">total_bookmark_num</span><span class="p">):</span>
+                <span class="c">#bookmark_num = ind</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">bookmark_list</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%d</span><span class="s">] bookmarked at </span><span class="si">%s</span><span class="s"> on </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="n">ind</span><span class="p">,</span> <span class="n">value</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">value</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                <span class="c"># append it to menu</span>
+                <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="s">&#39;&#39;</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_back_to_bookmark</span><span class="p">)</span> 
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">AppendBookmarkEvent</span><span class="p">(</span><span class="n">title</span><span class="o">=</span><span class="n">name</span><span class="p">,</span> 
+                                          <span class="n">hint</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> 
+                                          <span class="n">handler</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_back_to_bookmark</span><span class="p">))</span>
+
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_state_by_num</span><span class="p">(</span><span class="n">state_num</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">num</span><span class="p">))</span>
+            
+            <span class="bp">self</span><span class="o">.</span><span class="n">_get_input_list</span><span class="p">()</span> 
+            <span class="c">#make sure that the data is reset (especially</span>
+            <span class="c"># when loaded from a inv file)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">new_state</span> <span class="o">=</span> <span class="bp">False</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_state_data</span> <span class="o">=</span> <span class="bp">False</span>
+</div>
+<div class="viewcode-block" id="InvariantPanel.clear_panel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.clear_panel">[docs]</a>    <span class="k">def</span> <span class="nf">clear_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Clear panel to defaults, used by set_state of manager</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># default data testctrl</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_txt</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span>
+        <span class="n">data_name</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="n">data_qmin</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="n">data_qmax</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data_name</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_min_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data_qmin</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_max_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data_qmax</span><span class="p">))</span>
+        <span class="c">#reset output textctrl</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_output</span><span class="p">()</span>
+        <span class="c">#reset panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">reset_panel</span><span class="p">()</span>
+        <span class="c">#reset state w/o data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_state</span><span class="p">()</span>
+        <span class="c"># default flags for state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">new_state</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_state_data</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_power_out</span> <span class="o">=</span> <span class="bp">False</span>
+</div>
+<div class="viewcode-block" id="InvariantPanel.get_background"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_background">[docs]</a>    <span class="k">def</span> <span class="nf">get_background</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the background textcrtl value as a float</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">background</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">background_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">background</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;Need a background&quot;</span>
+        <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">background_tcl</span><span class="p">):</span>
+            <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="n">background</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Receive invalid value for background : </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">background</span><span class="p">)</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">msg</span>
+    </div>
+<div class="viewcode-block" id="InvariantPanel.get_scale"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_scale">[docs]</a>    <span class="k">def</span> <span class="nf">get_scale</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the scale textcrtl value as a float</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">scale</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">scale_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">scale</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;Need a background&quot;</span>
+        <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">scale_tcl</span><span class="p">):</span>
+            <span class="k">if</span> <span class="nb">float</span><span class="p">(</span><span class="n">scale</span><span class="p">)</span> <span class="o">&lt;=</span> <span class="mf">0.0</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">scale_tcl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">scale_tcl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Receive invalid value for scale: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">scale</span><span class="p">)</span>
+                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">msg</span>
+            <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="n">scale</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;Receive invalid value for scale : </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">scale</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="InvariantPanel.get_contrast"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_contrast">[docs]</a>    <span class="k">def</span> <span class="nf">get_contrast</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the contrast textcrtl value as a float</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">par_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">contrast_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+        <span class="n">contrast</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">par_str</span> <span class="o">!=</span><span class="s">&quot; &quot;</span> <span class="ow">and</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">contrast_tcl</span><span class="p">):</span>
+            <span class="n">contrast</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">par_str</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">contrast</span>
+    </div>
+<div class="viewcode-block" id="InvariantPanel.get_extrapolation_type"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_extrapolation_type">[docs]</a>    <span class="k">def</span> <span class="nf">get_extrapolation_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">low_q</span><span class="p">,</span> <span class="n">high_q</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get extrapolation type</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">extrapolation</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">low_q</span>  <span class="ow">and</span> <span class="ow">not</span> <span class="n">high_q</span><span class="p">:</span>
+            <span class="n">extrapolation</span> <span class="o">=</span> <span class="s">&quot;low&quot;</span>
+        <span class="k">elif</span> <span class="ow">not</span> <span class="n">low_q</span>  <span class="ow">and</span> <span class="n">high_q</span><span class="p">:</span>
+            <span class="n">extrapolation</span> <span class="o">=</span> <span class="s">&quot;high&quot;</span>
+        <span class="k">elif</span> <span class="n">low_q</span> <span class="ow">and</span> <span class="n">high_q</span><span class="p">:</span>
+            <span class="n">extrapolation</span> <span class="o">=</span> <span class="s">&quot;both&quot;</span>
+        <span class="k">return</span> <span class="n">extrapolation</span>
+            </div>
+<div class="viewcode-block" id="InvariantPanel.get_porod_const"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_porod_const">[docs]</a>    <span class="k">def</span> <span class="nf">get_porod_const</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the porod constant textcrtl value as a float</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">par_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">porod_constant_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+        <span class="n">porod_const</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">par_str</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span> <span class="ow">and</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">porod_constant_tcl</span><span class="p">):</span>
+            <span class="n">porod_const</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">par_str</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">porod_const</span>
+    </div>
+<div class="viewcode-block" id="InvariantPanel.get_volume"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_volume">[docs]</a>    <span class="k">def</span> <span class="nf">get_volume</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">inv</span><span class="p">,</span> <span class="n">contrast</span><span class="p">,</span> <span class="n">extrapolation</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get volume fraction</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">contrast</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">v</span><span class="p">,</span> <span class="n">dv</span> <span class="o">=</span> <span class="n">inv</span><span class="o">.</span><span class="n">get_volume_fraction_with_error</span><span class="p">(</span><span class="n">contrast</span><span class="o">=</span><span class="n">contrast</span><span class="p">,</span> 
+                                                <span class="n">extrapolation</span><span class="o">=</span><span class="n">extrapolation</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">volume_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">v</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">volume_err_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">dv</span><span class="p">))</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">volume_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">None</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">volume_err_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">None</span><span class="p">))</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error occurred computing volume &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; fraction: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                      <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span>
+                                                      <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+               </div>
+<div class="viewcode-block" id="InvariantPanel.get_surface"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_surface">[docs]</a>    <span class="k">def</span> <span class="nf">get_surface</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">inv</span><span class="p">,</span> <span class="n">contrast</span><span class="p">,</span> <span class="n">porod_const</span><span class="p">,</span> <span class="n">extrapolation</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get surface value</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">contrast</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">porod_const</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">s</span><span class="p">,</span> <span class="n">ds</span> <span class="o">=</span> <span class="n">inv</span><span class="o">.</span><span class="n">get_surface_with_error</span><span class="p">(</span><span class="n">contrast</span><span class="o">=</span><span class="n">contrast</span><span class="p">,</span>
+                                        <span class="n">porod_const</span><span class="o">=</span><span class="n">porod_const</span><span class="p">,</span>
+                                        <span class="n">extrapolation</span><span class="o">=</span><span class="n">extrapolation</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">surface_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">s</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">surface_err_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">ds</span><span class="p">))</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">surface_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">None</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">surface_err_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">None</span><span class="p">))</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error occurred computing &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;specific surface: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span>
+                                                       <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+                </div>
+<div class="viewcode-block" id="InvariantPanel.get_total_qstar"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_total_qstar">[docs]</a>    <span class="k">def</span> <span class="nf">get_total_qstar</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">inv</span><span class="p">,</span> <span class="n">extrapolation</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get total qstar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">qstar_total</span><span class="p">,</span> <span class="n">qstar_total_err</span> <span class="o">=</span> \
+                                    <span class="n">inv</span><span class="o">.</span><span class="n">get_qstar_with_error</span><span class="p">(</span><span class="n">extrapolation</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">qstar_total</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_err_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span>\
+                                    <span class="n">format_number</span><span class="p">(</span><span class="n">qstar_total_err</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_total</span> <span class="o">=</span> <span class="n">qstar_total</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_total_err</span> <span class="o">=</span> <span class="n">qstar_total_err</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_total</span> <span class="o">=</span> <span class="s">&quot;Error&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_total_err</span> <span class="o">=</span> <span class="s">&quot;Error&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">None</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_err_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="bp">None</span><span class="p">))</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error occurred computing invariant using&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; extrapolation: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span> <span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>  
+            </div>
+<div class="viewcode-block" id="InvariantPanel.get_low_qstar"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_low_qstar">[docs]</a>    <span class="k">def</span> <span class="nf">get_low_qstar</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">inv</span><span class="p">,</span> <span class="n">npts_low</span><span class="p">,</span> <span class="n">low_q</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get low qstar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">low_q</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span> 
+                <span class="n">qstar_low</span><span class="p">,</span> <span class="n">qstar_low_err</span> <span class="o">=</span> <span class="n">inv</span><span class="o">.</span><span class="n">get_qstar_low</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_low</span> <span class="o">=</span> <span class="n">qstar_low</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_low_err</span> <span class="o">=</span> <span class="n">qstar_low_err</span>
+                <span class="n">extrapolated_data</span> <span class="o">=</span> <span class="n">inv</span><span class="o">.</span><span class="n">get_extra_data_low</span><span class="p">(</span><span class="n">npts_in</span><span class="o">=</span><span class="n">npts_low</span><span class="p">)</span> 
+                <span class="n">power_low</span> <span class="o">=</span> <span class="n">inv</span><span class="o">.</span><span class="n">get_extrapolation_power</span><span class="p">(</span><span class="nb">range</span><span class="o">=</span><span class="s">&#39;low&#39;</span><span class="p">)</span>  
+                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">power_law_low</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">power_low</span><span class="p">))</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">plot_theory</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">extrapolated_data</span><span class="p">,</span>
+                                           <span class="n">name</span><span class="o">=</span><span class="s">&quot;Low-Q extrapolation&quot;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_low</span> <span class="o">=</span> <span class="s">&quot;ERROR&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_low_err</span> <span class="o">=</span> <span class="s">&quot;ERROR&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">plot_theory</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;Low-Q extrapolation&quot;</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error occurred computing low-Q &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;invariant: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                             <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+                <span class="k">raise</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">plot_theory</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;Low-Q extrapolation&quot;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span> 
+                <span class="k">pass</span>
+            </div>
+<div class="viewcode-block" id="InvariantPanel.get_high_qstar"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_high_qstar">[docs]</a>    <span class="k">def</span> <span class="nf">get_high_qstar</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">inv</span><span class="p">,</span> <span class="n">high_q</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get high qstar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">high_q</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span> 
+                <span class="n">qmax_plot</span> <span class="o">=</span> <span class="n">Q_MAXIMUM_PLOT</span> <span class="o">*</span> <span class="nb">max</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">qmax_plot</span> <span class="o">&gt;</span> <span class="n">Q_MAXIMUM</span><span class="p">:</span> 
+                    <span class="n">qmax_plot</span> <span class="o">=</span> <span class="n">Q_MAXIMUM</span>
+                <span class="n">qstar_high</span><span class="p">,</span> <span class="n">qstar_high_err</span> <span class="o">=</span> <span class="n">inv</span><span class="o">.</span><span class="n">get_qstar_high</span><span class="p">()</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_high</span> <span class="o">=</span> <span class="n">qstar_high</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_high_err</span> <span class="o">=</span> <span class="n">qstar_high_err</span>
+                <span class="n">power_high</span> <span class="o">=</span> <span class="n">inv</span><span class="o">.</span><span class="n">get_extrapolation_power</span><span class="p">(</span><span class="nb">range</span><span class="o">=</span><span class="s">&#39;high&#39;</span><span class="p">)</span> 
+                <span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">power_high</span><span class="p">))</span>
+                <span class="n">high_out_data</span> <span class="o">=</span> <span class="n">inv</span><span class="o">.</span><span class="n">get_extra_data_high</span><span class="p">(</span><span class="n">q_end</span><span class="o">=</span><span class="n">qmax_plot</span><span class="p">,</span>
+                                                        <span class="n">npts</span><span class="o">=</span><span class="mi">500</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">plot_theory</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">high_out_data</span><span class="p">,</span>
+                                           <span class="n">name</span><span class="o">=</span><span class="s">&quot;High-Q extrapolation&quot;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="c">#raise</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_high</span> <span class="o">=</span> <span class="s">&quot;ERROR&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_high_err</span> <span class="o">=</span> <span class="s">&quot;ERROR&quot;</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">plot_theory</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;High-Q extrapolation&quot;</span><span class="p">)</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error occurred computing high-Q &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;invariant: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                      <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+                <span class="k">raise</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">plot_theory</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;High-Q extrapolation&quot;</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span> 
+                <span class="k">pass</span>
+</div>
+<div class="viewcode-block" id="InvariantPanel.get_qstar"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_qstar">[docs]</a>    <span class="k">def</span> <span class="nf">get_qstar</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">inv</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get qstar</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">qstar</span><span class="p">,</span> <span class="n">qstar_err</span> <span class="o">=</span> <span class="n">inv</span><span class="o">.</span><span class="n">get_qstar_with_error</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar</span> <span class="o">=</span> <span class="n">qstar</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">qstar_err</span> <span class="o">=</span> <span class="n">qstar_err</span>
+             </div>
+<div class="viewcode-block" id="InvariantPanel.set_extrapolation_low"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.set_extrapolation_low">[docs]</a>    <span class="k">def</span> <span class="nf">set_extrapolation_low</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">inv</span><span class="p">,</span> <span class="n">low_q</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return float value necessary to compute invariant a low q</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#get funtion</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">guinier</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="n">function_low</span> <span class="o">=</span> <span class="s">&quot;guinier&quot;</span>
+        <span class="c"># get the function</span>
+        <span class="n">power_low</span> <span class="o">=</span> <span class="bp">None</span> <span class="c">#2.0/3.0</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">power_law_low</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="n">function_low</span> <span class="o">=</span> <span class="s">&quot;power_law&quot;</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_low</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="c">#set value of power_low to none to allow fitting</span>
+                <span class="n">power_low</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">power_low</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="p">):</span>
+                    <span class="n">power_low</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">power_low</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">low_q</span> <span class="p">:</span>
+                        <span class="c">#Raise error only when qstar at low q is requested</span>
+                        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Expect float for power at low q, &quot;</span>
+                        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; got </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">power_low</span><span class="p">)</span>
+                        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> 
+                                                  <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+       
+        <span class="c">#Get the number of points to extrapolated</span>
+        <span class="n">npts_low</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">npts_low_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>   
+        <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_low_tcl</span><span class="p">):</span>
+            <span class="n">npts_low</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">npts_low</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">low_q</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Expect float for number of points at low q,&quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; got </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">npts_low</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> 
+                                                  <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+        <span class="c">#Set the invariant calculator</span>
+        <span class="n">inv</span><span class="o">.</span><span class="n">set_extrapolation</span><span class="p">(</span><span class="nb">range</span><span class="o">=</span><span class="s">&quot;low&quot;</span><span class="p">,</span> <span class="n">npts</span><span class="o">=</span><span class="n">npts_low</span><span class="p">,</span>
+                                   <span class="n">function</span><span class="o">=</span><span class="n">function_low</span><span class="p">,</span> <span class="n">power</span><span class="o">=</span><span class="n">power_low</span><span class="p">)</span>    
+        <span class="k">return</span> <span class="n">inv</span><span class="p">,</span> <span class="n">npts_low</span>  
+    
+</div>
+<div class="viewcode-block" id="InvariantPanel.set_extrapolation_high"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.set_extrapolation_high">[docs]</a>    <span class="k">def</span> <span class="nf">set_extrapolation_high</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">inv</span><span class="p">,</span> <span class="n">high_q</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return float value necessary to compute invariant a high q</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">power_high</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#if self.power_law_high.GetValue():</span>
+        <span class="n">function_high</span> <span class="o">=</span> <span class="s">&quot;power_law&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_high</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="c">#set value of power_high to none to allow fitting</span>
+            <span class="n">power_high</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">power_high</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span><span class="p">):</span>
+                <span class="n">power_high</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">power_high</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">high_q</span><span class="p">:</span>
+                    <span class="c">#Raise error only when qstar at high q is requested</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Expect float for power at high q,&quot;</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; got </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">power_high</span><span class="p">)</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> 
+                                                  <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+                          
+        <span class="n">npts_high</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">npts_high_tcl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>   
+        <span class="k">if</span> <span class="n">check_float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_high_tcl</span><span class="p">):</span>
+            <span class="n">npts_high</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">npts_high</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">high_q</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Expect float for number of points at high q,&quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; got </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">npts_high</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> 
+                                                  <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+        <span class="n">inv</span><span class="o">.</span><span class="n">set_extrapolation</span><span class="p">(</span><span class="nb">range</span><span class="o">=</span><span class="s">&quot;high&quot;</span><span class="p">,</span> <span class="n">npts</span><span class="o">=</span><span class="n">npts_high</span><span class="p">,</span>
+                                   <span class="n">function</span><span class="o">=</span><span class="n">function_high</span><span class="p">,</span> <span class="n">power</span><span class="o">=</span><span class="n">power_high</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">inv</span><span class="p">,</span> <span class="n">npts_high</span>
+    </div>
+<div class="viewcode-block" id="InvariantPanel.display_details"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.display_details">[docs]</a>    <span class="k">def</span> <span class="nf">display_details</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        open another panel for more details on invariant calculation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">panel</span> <span class="o">=</span> <span class="n">InvariantDetailsPanel</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> 
+                                           <span class="n">qstar_container</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="p">)</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        <span class="n">panel</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="InvariantPanel.compute_invariant"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.compute_invariant">[docs]</a>    <span class="k">def</span> <span class="nf">compute_invariant</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        compute invariant </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\n\n</span><span class="s">Data must be loaded first in order&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; to perform a compution...&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+        <span class="c"># set a state for this computation for saving</span>
+        <span class="k">elif</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_compute_state</span><span class="p">(</span><span class="n">state</span><span class="o">=</span><span class="s">&#39;compute&#39;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\n\n</span><span class="s">Starting a new invariant computation...&quot;</span>            
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+            
+
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_details</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+        <span class="c">#clear outputs textctrl </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_output</span><span class="p">()</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">background</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_background</span><span class="p">()</span>
+            <span class="n">scale</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_scale</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Invariant Error: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+            <span class="k">return</span>
+        
+        <span class="n">low_q</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_low_cbox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="n">high_q</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_high_cbox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span> 
+        <span class="n">temp_data</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="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="p">)</span>
+        
+        <span class="c">#set invariant calculator </span>
+        <span class="n">inv</span> <span class="o">=</span> <span class="n">invariant</span><span class="o">.</span><span class="n">InvariantCalculator</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">temp_data</span><span class="p">,</span>
+                                            <span class="n">background</span><span class="o">=</span><span class="n">background</span><span class="p">,</span>
+                                            <span class="n">scale</span><span class="o">=</span><span class="n">scale</span><span class="p">)</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">inv</span><span class="p">,</span> <span class="n">npts_low</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_extrapolation_low</span><span class="p">(</span><span class="n">inv</span><span class="o">=</span><span class="n">inv</span><span class="p">,</span> <span class="n">low_q</span><span class="o">=</span><span class="n">low_q</span><span class="p">)</span>
+            <span class="n">inv</span><span class="p">,</span> <span class="n">npts_high</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_extrapolation_high</span><span class="p">(</span><span class="n">inv</span><span class="o">=</span><span class="n">inv</span><span class="p">,</span> <span class="n">high_q</span><span class="o">=</span><span class="n">high_q</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error occurred computing invariant: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                 <span class="n">info</span><span class="o">=</span><span class="s">&quot;warning&quot;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+            <span class="k">return</span>
+        <span class="c">#check the type of extrapolation</span>
+        <span class="n">extrapolation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_extrapolation_type</span><span class="p">(</span><span class="n">low_q</span><span class="o">=</span><span class="n">low_q</span><span class="p">,</span> <span class="n">high_q</span><span class="o">=</span><span class="n">high_q</span><span class="p">)</span>
+       
+        <span class="c">#Compute invariant</span>
+        <span class="n">bkg_changed</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">scale_changed</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_qstar</span><span class="p">(</span><span class="n">inv</span><span class="o">=</span><span class="n">inv</span><span class="p">)</span>
+            <span class="c">#if scale_changed or bkg_changed:</span>
+            <span class="c">#self._manager.plot_data(data=inv.get_data())</span>
+            
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span><span class="o">=</span> <span class="s">&quot;Error occurred computing invariant: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> 
+                                                  <span class="n">info</span><span class="o">=</span><span class="s">&quot;warning&quot;</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+            <span class="k">return</span>
+        <span class="c">#self.Show(False)</span>
+        <span class="n">r_msg</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">r_msg</span> <span class="o">=</span> <span class="s">&#39;Low Q: &#39;</span>
+            <span class="c">#Compute qstar extrapolated to low q range </span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_low_qstar</span><span class="p">(</span><span class="n">inv</span><span class="o">=</span><span class="n">inv</span><span class="p">,</span> <span class="n">npts_low</span><span class="o">=</span><span class="n">npts_low</span><span class="p">,</span> <span class="n">low_q</span><span class="o">=</span><span class="n">low_q</span><span class="p">)</span>
+            <span class="n">r_msg</span> <span class="o">=</span> <span class="s">&#39;High Q: &#39;</span>
+            <span class="c">#Compute qstar extrapolated to high q range </span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_high_qstar</span><span class="p">(</span><span class="n">inv</span><span class="o">=</span><span class="n">inv</span><span class="p">,</span> <span class="n">high_q</span><span class="o">=</span><span class="n">high_q</span><span class="p">)</span>
+            <span class="n">r_msg</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+            <span class="c">#Compute qstar extrapolated to total q range </span>
+            <span class="c">#and set value to txtcrtl</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_total_qstar</span><span class="p">(</span><span class="n">inv</span><span class="o">=</span><span class="n">inv</span><span class="p">,</span> <span class="n">extrapolation</span><span class="o">=</span><span class="n">extrapolation</span><span class="p">)</span>
+            <span class="c"># Parse additional parameters</span>
+            <span class="n">porod_const</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_porod_const</span><span class="p">()</span>        
+            <span class="n">contrast</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_contrast</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="n">r_msg</span> <span class="o">+</span> <span class="s">&quot;Error occurred computing invariant: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
+                                                            <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> 
+                                                  <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c">#Compute volume and set value to txtcrtl</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_volume</span><span class="p">(</span><span class="n">inv</span><span class="o">=</span><span class="n">inv</span><span class="p">,</span> <span class="n">contrast</span><span class="o">=</span><span class="n">contrast</span><span class="p">,</span>
+                            <span class="n">extrapolation</span><span class="o">=</span><span class="n">extrapolation</span><span class="p">)</span>
+            <span class="c">#compute surface and set value to txtcrtl</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error occurred computing invariant: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                  <span class="n">info</span><span class="o">=</span><span class="s">&quot;warning&quot;</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">get_surface</span><span class="p">(</span><span class="n">inv</span><span class="o">=</span><span class="n">inv</span><span class="p">,</span> <span class="n">contrast</span><span class="o">=</span><span class="n">contrast</span><span class="p">,</span>
+                                    <span class="n">porod_const</span><span class="o">=</span><span class="n">porod_const</span><span class="p">,</span> 
+                                    <span class="n">extrapolation</span><span class="o">=</span><span class="n">extrapolation</span><span class="p">)</span>
+            
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Error occurred computing invariant: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                  <span class="n">info</span><span class="o">=</span><span class="s">&quot;warning&quot;</span><span class="p">,</span>
+                                                  <span class="nb">type</span><span class="o">=</span><span class="s">&quot;stop&quot;</span><span class="p">))</span>
+            
+        <span class="c">#compute percentage of each invariant</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="o">.</span><span class="n">compute_percentage</span><span class="p">()</span>
+        
+        <span class="c">#display a message</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_message</span><span class="p">()</span>
+
+        <span class="c"># reset power_out to default to get ready for another &#39;_on_text&#39;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_power_out</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">container</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="bp">self</span><span class="o">.</span><span class="n">inv_container</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_time_stamp</span><span class="p">()</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">__str__</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">set_report_string</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_power_out</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span> <span class="o">=</span> <span class="n">msg</span> <span class="p">))</span>
+
+        <span class="c">#enable the button_ok for more details</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span>
+                <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">Finished invariant computation...&#39;</span><span class="p">))</span>
+        <span class="c">#self.Show(True)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            </div>
+<div class="viewcode-block" id="InvariantPanel.on_undo"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.on_undo">[docs]</a>    <span class="k">def</span> <span class="nf">on_undo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Go back to the previous state</span>
+<span class="sd">        </span>
+<span class="sd">        : param event: undo button event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_power_out</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c"># get the previous state_num</span>
+        <span class="n">pre_state_num</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">])</span> <span class="o">-</span> <span class="mi">1</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">get_state_by_num</span><span class="p">(</span><span class="n">state_num</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">pre_state_num</span><span class="p">))</span>
+        
+        <span class="k">if</span> <span class="nb">float</span><span class="p">(</span><span class="n">pre_state_num</span><span class="p">)</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_undo_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_undo_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_redo_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_power_out</span> <span class="o">=</span> <span class="bp">False</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">_info_state_num</span><span class="p">()</span>
+
+        </div>
+<div class="viewcode-block" id="InvariantPanel.on_redo"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.on_redo">[docs]</a>    <span class="k">def</span> <span class="nf">on_redo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Go forward to the previous state</span>
+<span class="sd">        </span>
+<span class="sd">        : param event: redo button event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_power_out</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c"># get the next state_num</span>
+        <span class="n">next_state_num</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">])</span> <span class="o">+</span> <span class="mi">1</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">get_state_by_num</span><span class="p">(</span><span class="n">state_num</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">next_state_num</span><span class="p">))</span>
+        
+        <span class="k">if</span> <span class="nb">float</span><span class="p">(</span><span class="n">next_state_num</span><span class="p">)</span><span class="o">+</span><span class="mi">2</span> <span class="o">&gt;</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_redo_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_redo_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_undo_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_power_out</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_info_state_num</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="InvariantPanel.on_preview"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.on_preview">[docs]</a>    <span class="k">def</span> <span class="nf">on_preview</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Invoke report dialog panel</span>
+<span class="sd">        </span>
+<span class="sd">        : param event: report button event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">sas.perspectives.invariant.report_dialog</span> <span class="kn">import</span> <span class="n">ReportDialog</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">set_report_string</span><span class="p">()</span>
+        <span class="n">report_html_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">report_str</span>
+        <span class="n">report_text_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">__str__</span><span class="p">()</span>
+        <span class="n">report_img</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">image</span>
+        <span class="n">report_list</span> <span class="o">=</span> <span class="p">[</span><span class="n">report_html_str</span><span class="p">,</span> <span class="n">report_text_str</span><span class="p">,</span> <span class="n">report_img</span><span class="p">]</span>
+        <span class="n">dialog</span> <span class="o">=</span> <span class="n">ReportDialog</span><span class="p">(</span><span class="n">report_list</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="n">dialog</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        </div>
+<div class="viewcode-block" id="InvariantPanel.get_state_by_num"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_state_by_num">[docs]</a>    <span class="k">def</span> <span class="nf">get_state_by_num</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state_num</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the state given by number</span>
+<span class="sd">        </span>
+<span class="sd">        : param state_num: the given state number</span>
+<span class="sd">        &quot;&quot;&quot;</span>     
+        <span class="k">if</span> <span class="n">state_num</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+
+        <span class="n">backup_state_list</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="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">)</span>
+        
+        <span class="c"># get the previous state</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">current_state</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="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">state_num</span><span class="p">)])</span>
+            <span class="c"># get the previously computed state number </span>
+            <span class="c">#(computation before the state changes happened)</span>
+            <span class="n">current_compute_num</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">current_state</span><span class="p">[</span><span class="s">&#39;compute_num&#39;</span><span class="p">])</span>
+        <span class="k">except</span> <span class="p">:</span>
+            <span class="k">raise</span>
+            <span class="c">#raise ValueError,  &quot;No such state exists in history&quot;</span>
+        
+        <span class="c"># get the state at pre_compute_num</span>
+        <span class="n">comp_state</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="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="n">current_compute_num</span><span class="p">])</span>
+
+        <span class="c"># set the parameters</span>
+        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">comp_state</span><span class="p">:</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="n">comp_state</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">exec</span> <span class="s">&quot;self.</span><span class="si">%s</span><span class="s">.SetValue(str(</span><span class="si">%s</span><span class="s">))&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>
+                <span class="k">exec</span> <span class="s">&quot;self.</span><span class="si">%s</span><span class="s">.SetValue(</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_invariant</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+       
+        <span class="c"># set the input params at the state at pre_state_num</span>
+        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">current_state</span><span class="p">:</span>
+            <span class="c"># set the inputs and boxes</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="n">current_state</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">exec</span> <span class="s">&#39;self.</span><span class="si">%s</span><span class="s">.SetValue(str(</span><span class="si">%s</span><span class="s">))&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>
+                <span class="k">exec</span> <span class="s">&#39;self.</span><span class="si">%s</span><span class="s">.SetValue(</span><span class="si">%s</span><span class="s">)&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">_enable_high_q_section</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_enable_low_q_section</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span> <span class="o">=</span> <span class="n">backup_state_list</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span> <span class="o">=</span> <span class="n">current_state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span> <span class="o">=</span> <span class="n">state_num</span>
+
+        </div>
+<div class="viewcode-block" id="InvariantPanel.get_bookmark_by_num"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.get_bookmark_by_num">[docs]</a>    <span class="k">def</span> <span class="nf">get_bookmark_by_num</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the bookmark state given by number</span>
+<span class="sd">        </span>
+<span class="sd">        : param num: the given bookmark number</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">current_state</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="n">comp_state</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="n">backup_state_list</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="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">)</span>
+
+        <span class="c"># get the previous state</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">current_state</span><span class="p">,</span><span class="n">comp_state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">bookmark_list</span><span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="n">num</span><span class="p">)]</span> 
+        <span class="k">except</span> <span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span>  <span class="s">&quot;No such bookmark exists&quot;</span>
+
+        <span class="c"># set the parameters</span>
+        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">comp_state</span><span class="p">:</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="n">comp_state</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">exec</span> <span class="s">&quot;self.</span><span class="si">%s</span><span class="s">.SetValue(str(</span><span class="si">%s</span><span class="s">))&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>
+                <span class="k">exec</span> <span class="s">&quot;self.</span><span class="si">%s</span><span class="s">.SetValue(</span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_invariant</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="c"># set the input params at the state of pre_state_num</span>
+        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">current_state</span><span class="p">:</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="n">current_state</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">exec</span> <span class="s">&#39;self.</span><span class="si">%s</span><span class="s">.SetValue(str(</span><span class="si">%s</span><span class="s">))&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>
+                <span class="k">exec</span> <span class="s">&#39;self.</span><span class="si">%s</span><span class="s">.SetValue(</span><span class="si">%s</span><span class="s">)&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">pass</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</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">current_state</span><span class="p">)</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">_enable_high_q_section</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_enable_low_q_section</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span> <span class="o">=</span> <span class="n">backup_state_list</span>
+        <span class="c">#self.state.saved_state = current_state</span>
+        <span class="c">#self.state.state_num = state_num</span>
+</div>
+<div class="viewcode-block" id="InvariantPanel.reset_panel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.reset_panel">[docs]</a>    <span class="k">def</span> <span class="nf">reset_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        set the panel at its initial state.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">background_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">BACKGROUND</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">scale_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">SCALE</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">contrast_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">CONTRAST</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">porod_constant_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&#39;&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_low_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">NPTS</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_low_cbox</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_low</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">POWER</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">guinier</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_high_cbox</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_high</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">POWER</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_high_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">NPTS</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_details</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="c">#Change the state of txtcrtl to enable/disable</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_enable_low_q_section</span><span class="p">()</span>
+        <span class="c">#Change the state of txtcrtl to enable/disable</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_enable_high_q_section</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_reset_output</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_undo_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_redo_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        <span class="c">#self.SetupScrolling()</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_set_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the state list</span>
+<span class="sd">        </span>
+<span class="sd">        :param event: rb/cb event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        <span class="n">obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">obj</span><span class="o">.</span><span class="n">GetName</span><span class="p">())</span>
+        <span class="n">value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="n">rb_list</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&#39;power_law_low&#39;</span><span class="p">,</span> <span class="s">&#39;guinier&#39;</span><span class="p">],</span>
+                   <span class="p">[</span><span class="s">&#39;fit_enable_low&#39;</span><span class="p">,</span> <span class="s">&#39;fix_enable_low&#39;</span><span class="p">],</span>
+                   <span class="p">[</span><span class="s">&#39;fit_enable_high&#39;</span><span class="p">,</span> <span class="s">&#39;fix_enable_high&#39;</span><span class="p">]]</span>
+
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">value</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">value</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">==</span><span class="s">&#39;&#39;</span><span class="p">:</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="s">&#39;None&#39;</span>
+            <span class="k">exec</span> <span class="s">&#39;self.state.</span><span class="si">%s</span><span class="s"> = </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">exec</span> <span class="s">&quot;self.state.saved_state[&#39;</span><span class="si">%s</span><span class="s">&#39;] = </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span>  <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            
+            <span class="c"># set the count part of radio button clicked </span>
+            <span class="c">#False for the saved_state</span>
+            <span class="k">for</span> <span class="n">title</span><span class="p">,</span> <span class="n">content</span> <span class="ow">in</span> <span class="n">rb_list</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">name</span> <span class="o">==</span>  <span class="n">title</span><span class="p">:</span>
+                    <span class="n">name</span> <span class="o">=</span> <span class="n">content</span> 
+                    <span class="n">value</span> <span class="o">=</span> <span class="bp">False</span>     
+                <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="n">content</span><span class="p">:</span>
+                    <span class="n">name</span> <span class="o">=</span> <span class="n">title</span>
+                    <span class="n">value</span> <span class="o">=</span> <span class="bp">False</span> 
+            <span class="k">exec</span> <span class="s">&quot;self.state.saved_state[&#39;</span><span class="si">%s</span><span class="s">&#39;] = </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span>  <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>     
+            
+            <span class="c"># Instead of changing the future, create a new future.</span>
+            <span class="n">max_state_num</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span>   
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">max_state_num</span>   
+            
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span><span class="p">)]</span> <span class="o">=</span> \
+                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">clone_state</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>           
+            <span class="k">pass</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_undo_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_redo_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="c">#event.Skip()</span>
+                   
+    <span class="k">def</span> <span class="nf">_set_compute_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Notify the compute_invariant state to self.state</span>
+<span class="sd">        </span>
+<span class="sd">        : param state: set &#39;compute&#39; when the computation is</span>
+<span class="sd">        activated by the &#39;compute&#39; button, else None</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># reset the default</span>
+        <span class="k">if</span> <span class="n">state</span> <span class="o">!=</span> <span class="s">&#39;compute&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">new_state</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_power_out</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">is_power_out</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c"># Instead of changing the future, create a new future.</span>
+        <span class="n">max_state_num</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span>   
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">max_state_num</span>        
+        <span class="c"># A new computation is also A state</span>
+        <span class="c">#copy.deepcopy(self.state.saved_state)</span>
+        <span class="n">temp_saved_states</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">clone_state</span><span class="p">()</span>
+        <span class="n">temp_saved_states</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span> <span class="o">=</span> <span class="n">temp_saved_states</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span>
+
+                
+        <span class="c"># set the state number of the computation </span>
+        <span class="k">if</span> <span class="n">state</span> <span class="o">==</span> <span class="s">&#39;compute&#39;</span><span class="p">:</span>
+            <span class="n">temp_saved_states</span><span class="p">[</span><span class="s">&#39;compute_num&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</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">temp_saved_states</span><span class="p">)</span>
+        <span class="c">#copy.deepcopy(self.state.saved_state)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span><span class="p">)]</span> <span class="o">=</span> \
+                                        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">clone_state</span><span class="p">()</span>
+        
+        <span class="c"># A computation is a new state, so delete the states with any higher</span>
+        <span class="c"># state numbers</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">)):</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">del</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">i</span><span class="p">)])</span>
+            <span class="k">except</span><span class="p">:</span> 
+                <span class="k">pass</span>
+        <span class="c"># Enable the undo button if it was not</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_undo_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_redo_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_reset_state_list</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Reset the state_list just before data was loading:</span>
+<span class="sd">        Used in &#39;set_current_data()&#39;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#if data == None: return</span>
+        <span class="c">#temp_state = self.state.clone_state()</span>
+        <span class="c">#copy.deepcopy(self.state.saved_state)</span>
+        <span class="c"># Clear the list </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">bookmark_list</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
+        <span class="c"># Set defaults</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;compute_num&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;file&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_data</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;file&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;None&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;file&#39;</span><span class="p">]</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">=</span> <span class="s">&quot;(&#39;00:00:00&#39;, &#39;00/00/0000&#39;)&quot;</span>
+
+        <span class="c"># Put only the current state in the list</span>
+        <span class="c">#copy.deepcopy(self.state.saved_state)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span><span class="p">)]</span> <span class="o">=</span> \
+                                                <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">clone_state</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_undo_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_redo_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+
+        
+    <span class="k">def</span> <span class="nf">_on_text</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Catch text change event to add the state to the state_list</span>
+<span class="sd">        </span>
+<span class="sd">        :param event: txtctr event ; assumes not None</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="k">return</span>
+        <span class="c"># check if this event is from do/undo button</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;is_time_machine&#39;</span><span class="p">]</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">new_state</span><span class="p">:</span>
+            <span class="c">#event.Skip()</span>
+            <span class="k">return</span>
+        
+        <span class="c"># get the object</span>
+        <span class="n">obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">obj</span><span class="o">.</span><span class="n">GetName</span><span class="p">())</span>
+        <span class="n">value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="n">state_num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span>
+
+        <span class="c"># text event is a new state, so delete the states with higher state_num</span>
+        <span class="c"># i.e., change the future</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">state_num</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">)):</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">del</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">i</span><span class="p">)])</span>
+            <span class="k">except</span><span class="p">:</span> 
+                <span class="k">pass</span>
+        
+        <span class="c"># Instead of changing the future, create a new future.</span>
+        <span class="c">#max_state_num = len(self.state.state_list)-1   </span>
+        <span class="c">#self.state.saved_state[&#39;state_num&#39;] = max_state_num</span>
+
+        <span class="c"># try to add new state of the text changes in the state_list</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span> 
+                <span class="n">value</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+            <span class="k">exec</span> <span class="s">&quot;self.state.</span><span class="si">%s</span><span class="s"> = &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">exec</span> <span class="s">&quot;self.state.saved_state[&#39;</span><span class="si">%s</span><span class="s">&#39;] = &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span>  <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">exec</span> <span class="s">&quot;self.state.input_list[&#39;</span><span class="si">%s</span><span class="s">&#39;] = &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_power_out</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">name</span> <span class="o">!=</span> <span class="s">&#39;power_low_tcl&#39;</span> <span class="ow">and</span> <span class="n">name</span> <span class="o">!=</span> <span class="s">&#39;power_high_tcl&#39;</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span>
+            <span class="c">#copy.deepcopy(self.state.saved_state)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span><span class="p">)]</span> <span class="o">=</span> \
+                                        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">clone_state</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+
+        <span class="c">#event.Skip()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_undo_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_redo_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+       
+    <span class="k">def</span> <span class="nf">_on_out_text</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>     
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Catch ouput text change to add the state </span>
+<span class="sd">        </span>
+<span class="sd">        :param event: txtctr event ; assumes not None</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>    
+        <span class="c"># get the object</span>
+        <span class="n">obj</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">obj</span><span class="o">.</span><span class="n">GetName</span><span class="p">())</span>
+        <span class="n">value</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">obj</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">exec</span> <span class="s">&quot;self.state.saved_state[&#39;</span><span class="si">%s</span><span class="s">&#39;] = &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span>  <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span><span class="p">)]</span> <span class="o">=</span> \
+                                <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">clone_state</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">pass</span>
+        <span class="c">#if event != None: event.Skip()</span>
+
+    <span class="k">def</span> <span class="nf">_get_input_list</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>     
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        get input_list; called by set_state</span>
+<span class="sd">        &quot;&quot;&quot;</span>    
+        <span class="c"># get state num of the last compute state</span>
+        <span class="n">compute_num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;compute_num&#39;</span><span class="p">]</span>
+        <span class="c"># find values and put into the input list</span>
+        <span class="k">for</span> <span class="n">key1</span><span class="p">,</span> <span class="n">value1</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">compute_num</span><span class="p">)]</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span> 
+            <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">input_list</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span> 
+                <span class="k">if</span> <span class="n">key</span> <span class="o">==</span> <span class="n">key1</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">input_list</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">value1</span>
+                    <span class="k">break</span>
+        
+    <span class="k">def</span> <span class="nf">_set_bookmark_menu</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Setup &#39;bookmark&#39; context menu</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Create context menu for page</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_bmark</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MenuItem</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;BookMark&quot;</span><span class="p">,</span>
+                                  <span class="s">&quot; Bookmark the panel to recall it later&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="o">.</span><span class="n">AppendItem</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_bmark</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_bmark</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_bookmark</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="o">.</span><span class="n">AppendSeparator</span><span class="p">()</span>
+        <span class="bp">self</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_CONTEXT_MENU</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_context_menu</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="InvariantPanel.on_bookmark"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.on_bookmark">[docs]</a>    <span class="k">def</span> <span class="nf">on_bookmark</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Save the panel state in memory and add the list on</span>
+<span class="sd">        the popup menu on bookmark context menu event</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_data</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="k">return</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="k">return</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bookmark_num</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="c"># date and time of the event</span>
+        <span class="n">my_time</span><span class="p">,</span> <span class="n">date</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_time_stamp</span><span class="p">()</span>
+        <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span>
+        <span class="n">compute_num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;compute_num&#39;</span><span class="p">]</span>
+        <span class="c"># name and message of the bookmark list</span>
+        <span class="n">msg</span> <span class="o">=</span>  <span class="s">&quot;State saved at </span><span class="si">%s</span><span class="s"> on </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="n">my_time</span><span class="p">,</span> <span class="n">date</span><span class="p">)</span>
+         <span class="c">## post help message for the selected model </span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; Right click on the panel to retrieve this state&quot;</span>
+        <span class="c">#wx.PostEvent(self.parent.parent, StatusEvent(status = msg ))</span>
+        <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;</span><span class="si">%d</span><span class="s">] bookmarked at </span><span class="si">%s</span><span class="s"> on </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bookmark_num</span><span class="p">,</span> <span class="n">my_time</span><span class="p">,</span> <span class="n">date</span><span class="p">)</span>
+        
+        <span class="c"># append it to menu</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_back_to_bookmark</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">clone_state</span><span class="p">()</span>
+        <span class="n">comp_state</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="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">compute_num</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">bookmark_list</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">bookmark_num</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="n">my_time</span><span class="p">,</span> <span class="n">date</span><span class="p">,</span>
+                                                       <span class="n">state</span><span class="p">,</span><span class="n">comp_state</span><span class="p">]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">toXML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">doc</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">entry_node</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&quot;info&quot;</span><span class="p">))</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                     <span class="n">AppendBookmarkEvent</span><span class="p">(</span><span class="n">title</span><span class="o">=</span><span class="n">name</span><span class="p">,</span> 
+                                         <span class="n">hint</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">),</span>
+                                          <span class="n">handler</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_back_to_bookmark</span><span class="p">))</span>
+</div>
+    <span class="k">def</span> <span class="nf">_back_to_bookmark</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Bring the panel back to the state of bookmarked requested by</span>
+<span class="sd">        context menu event</span>
+<span class="sd">        and set it as a new state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">on_perspective</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+        <span class="n">menu</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="c">## post help message for the selected model </span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="n">menu</span><span class="o">.</span><span class="n">GetHelpString</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; reloaded&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span> <span class="o">=</span> <span class="n">msg</span> <span class="p">))</span>
+        
+        <span class="n">name</span> <span class="o">=</span> <span class="n">menu</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        
+        <span class="n">num</span><span class="p">,</span> <span class="n">time</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;]&#39;</span><span class="p">)</span>
+        <span class="n">current_state_num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">get_bookmark_by_num</span><span class="p">(</span><span class="n">num</span><span class="p">)</span>
+        <span class="n">state_num</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">current_state_num</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">state_num</span>
+        <span class="c">#copy.deepcopy(self.state.saved_state)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">state_num</span><span class="p">)]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">clone_state</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span> <span class="o">=</span> <span class="n">state_num</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_undo_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_info_bookmark_num</span><span class="p">(</span><span class="n">event</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_info_bookmark_num</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        print the bookmark number in info</span>
+<span class="sd">        </span>
+<span class="sd">        : event: popUpMenu event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="k">return</span>
+        <span class="c"># get the object</span>
+        <span class="n">menu</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">menu</span><span class="o">.</span><span class="n">FindItemById</span><span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="n">text</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">GetText</span><span class="p">()</span>
+        <span class="n">num</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;]&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;bookmark num = </span><span class="si">%s</span><span class="s"> &quot;</span><span class="o">%</span> <span class="n">num</span>
+        
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span> <span class="o">=</span> <span class="n">msg</span> <span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">_info_state_num</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        print the current state number in info</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;state num = &quot;</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="o">.</span><span class="n">state_num</span>
+        
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span> <span class="o">=</span> <span class="n">msg</span><span class="p">))</span>
+                         
+    <span class="k">def</span> <span class="nf">_get_time_stamp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return time and date stings</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># date and time </span>
+        <span class="n">year</span><span class="p">,</span> <span class="n">month</span><span class="p">,</span> <span class="n">day</span><span class="p">,</span> <span class="n">hour</span><span class="p">,</span> <span class="n">minute</span><span class="p">,</span> <span class="n">second</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> \
+                                    <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">()</span>
+        <span class="n">my_time</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">hour</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;:&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">minute</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;:&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">second</span><span class="p">)</span>
+        <span class="n">date</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span> <span class="n">month</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;/&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">day</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;/&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">year</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">my_time</span><span class="p">,</span> <span class="n">date</span>
+   
+            
+<div class="viewcode-block" id="InvariantPanel.on_save"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantPanel.on_save">[docs]</a>    <span class="k">def</span> <span class="nf">on_save</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span> 
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Save invariant state into a file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Ask the user the location of the file to write to.</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_save_location</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>
+        <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="bp">self</span><span class="p">,</span> <span class="s">&quot;Choose a file&quot;</span><span class="p">,</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span><span class="p">,</span> \
+                            <span class="bp">self</span><span class="o">.</span><span class="n">window_caption</span><span class="p">,</span> <span class="s">&quot;*.inv&quot;</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">SAVE</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> \
+                    <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        <span class="c"># MAC always needs the extension for saving</span>
+        <span class="n">extens</span> <span class="o">=</span> <span class="s">&quot;.inv&quot;</span>
+        <span class="c"># Make sure the ext included in the file name</span>
+        <span class="n">fName</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">path</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">extens</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">save_file</span><span class="p">(</span><span class="n">filepath</span><span class="o">=</span><span class="n">fName</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">state</span><span class="p">)</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_show_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">mssg</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="n">msg</span><span class="o">=</span><span class="s">&#39;Warning&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show warning message when resetting data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># no message for now</span>
+        <span class="k">return</span> <span class="bp">True</span>
+        
+    <span class="k">def</span> <span class="nf">_reset_output</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        clear outputs textcrtl</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_tcl</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_err_tcl</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_tcl</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_err_tcl</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">surface_tcl</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">surface_err_tcl</span><span class="o">.</span><span class="n">Clear</span><span class="p">()</span>
+        <span class="c">#prepare a new container to put result of invariant</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">inv_container</span> <span class="o">=</span> <span class="n">InvariantContainer</span><span class="p">()</span>
+
+    
+    <span class="k">def</span> <span class="nf">_on_context_menu</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        On context menu</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetPosition</span><span class="p">()</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ScreenToClient</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">PopupMenu</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">popUpMenu</span><span class="p">,</span> <span class="n">pos</span><span class="p">)</span> 
+      
+    <span class="k">def</span> <span class="nf">_define_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Define main sizers needed for this panel</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Box sizers must be defined first before </span>
+        <span class="c">#defining buttons/textctrls (MAC).</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</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>
+        <span class="c">#Sizer related to outputs</span>
+        <span class="n">outputs_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Outputs&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">outputs_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs_sizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_STATICBOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="c">#Sizer related to data</span>
+        <span class="n">data_name_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;I(q) Data Source&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_boxsizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">data_name_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_boxsizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_STATICBOX_WIDTH</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_sizer</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>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_range_sizer</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>
+        <span class="c">#Sizer related to inputs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_input</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">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="c">#Sizer related to inputs</span>
+        <span class="n">inputs_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Customized Inputs&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">inputs_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">inputs_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">inputs_sizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_STATICBOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="c">#Sizer related to extrapolation</span>
+        <span class="n">extrapolation_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Extrapolation&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">extrapolation_box</span><span class="p">,</span>
+                                                        <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_sizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_STATICBOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_range_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_low_high_sizer</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>
+        <span class="c">#Sizer related to extrapolation at low q range</span>
+        <span class="n">low_q_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Low Q&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_extrapolation_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">low_q_box</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+      
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="c">#Sizer related to extrapolation at low q range</span>
+        <span class="n">high_q_box</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;High Q&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_extrapolation_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">high_q_box</span><span class="p">,</span>
+                                                          <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_q_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="c">#sizer to define outputs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="c">#Sizer related to invariant output</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="c">#Sizer related to button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="n">_STATICBOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+        <span class="c">#Sizer related to save button</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">save_button_sizer</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>
+        
+    <span class="k">def</span> <span class="nf">_layout_data_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to data&#39;s name</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#Sizer hint </span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">hint_msg</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_txt</span><span class="o">.</span><span class="n">SetForegroundColour</span><span class="p">(</span><span class="s">&quot;red&quot;</span><span class="p">)</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Highlight = mouse the mouse&#39;s cursor on the data until&quot;</span>
+        <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; the plot&#39;s color changes to yellow&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_txt</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_txt</span><span class="p">)</span>
+        <span class="c">#Data name [string]</span>
+        <span class="n">data_name_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Name:&#39;</span><span class="p">)</span>  
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">4</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                            <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Data&#39;s name.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">data_name_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_name_tcl</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">EXPAND</span><span class="p">)])</span>
+        <span class="c">#Data range [string]</span>
+        <span class="n">data_range_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Total Q Range (1/A): &#39;</span><span class="p">)</span> 
+        <span class="n">data_min_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Min : &#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_min_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                           <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;data_min_tcl&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_min_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;The minimum value of q range.&quot;</span><span class="p">)</span>
+        <span class="n">data_max_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Max : &#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_max_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                           <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;data_max_tcl&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_max_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;The maximum value of q range.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_range_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">data_range_txt</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">RIGHT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="n">data_min_txt</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">RIGHT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_min_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="n">data_max_txt</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">RIGHT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                       <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_max_tcl</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">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_name_boxsizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">hint_msg_sizer</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">ALL</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_name_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                     <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_range_sizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+    
+    <span class="k">def</span> <span class="nf">_enable_fit_power_law_low</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Enable and disable the power value editing</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+    
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_low</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_low</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_low</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_low</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_state</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
+           
+    <span class="k">def</span> <span class="nf">_enable_low_q_section</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Disable or enable some button if the user enable low q extrapolation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_low_cbox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_low_tcl</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_low</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_low</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">guinier</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">power_law_low</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_low_tcl</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_low</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_low</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">guinier</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">power_law_low</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_enable_power_law_low</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_enable_fit_power_law_low</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_state</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">_enable_power_law_low</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Enable editing power law section at low q range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">guinier</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">power_law_low</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_low</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_low</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">power_law_low</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_low</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_low</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_enable_fit_power_law_low</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_state</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
+            
+    <span class="k">def</span> <span class="nf">_layout_extrapolation_low</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to extrapolation at low q range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_low_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                           <span class="s">&quot;Enable Extrapolate Low Q&quot;</span><span class="p">,</span>
+                                           <span class="n">name</span><span class="o">=</span><span class="s">&#39;enable_low_cbox&#39;</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="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_low_cbox</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span>
+                                         <span class="bp">self</span><span class="o">.</span><span class="n">_enable_low_q_section</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_low</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Fix&#39;</span><span class="p">,</span>
+                                         <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</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">RB_GROUP</span><span class="p">,</span>
+                                         <span class="n">name</span><span class="o">=</span><span class="s">&#39;fix_enable_low&#39;</span><span class="p">)</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_enable_fit_power_law_low</span><span class="p">,</span>
+                                     <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_low</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_low</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Fit&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                             <span class="n">name</span><span class="o">=</span><span class="s">&#39;fit_enable_low&#39;</span><span class="p">)</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_enable_fit_power_law_low</span><span class="p">,</span> 
+                                        <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_low</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">guinier</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Guinier&#39;</span><span class="p">,</span>
+                                         <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</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">RB_GROUP</span><span class="p">,</span>
+                                         <span class="n">name</span><span class="o">=</span><span class="s">&#39;guinier&#39;</span><span class="p">)</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_enable_power_law_low</span><span class="p">,</span>
+                                     <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">guinier</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>        
+        <span class="bp">self</span><span class="o">.</span><span class="n">power_law_low</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Power Law&#39;</span><span class="p">,</span>
+                                            <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;power_law_low&#39;</span><span class="p">)</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_enable_power_law_low</span><span class="p">,</span> 
+                                        <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">power_law_low</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        
+        <span class="n">npts_low_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Npts&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_low_tcl</span> <span class="o">=</span> <span class="n">InvTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                        <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">2</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span>
+                                        <span class="n">name</span><span class="o">=</span><span class="s">&#39;npts_low_tcl&#39;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">npts_low_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_text</span><span class="p">)</span>
+        <span class="n">msg_hint</span> <span class="o">=</span> <span class="s">&quot;Number of Q points to consider&quot;</span>
+        <span class="n">msg_hint</span> <span class="o">+=</span> <span class="s">&quot;while extrapolating the low-Q region&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_low_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">msg_hint</span><span class="p">)</span>
+        <span class="n">power_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Power&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span> <span class="o">=</span> <span class="n">InvTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">2</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span>
+                                         <span class="n">name</span><span class="o">=</span><span class="s">&#39;power_low_tcl&#39;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_text</span><span class="p">)</span>
+       
+        <span class="n">power_hint_txt</span> <span class="o">=</span> <span class="s">&quot;Exponent to apply to the Power_law function.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">power_hint_txt</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">enable_low_cbox</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">npts_low_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_low_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">guinier</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">power_law_low</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="c"># Parameter controls for power law</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_low</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_low</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span>
+                           <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">power_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">power_low_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">low_extrapolation_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">low_q_sizer</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_enable_fit_power_law_high</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Enable and disable the power value editing</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+    
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_high</span><span class="o">.</span><span class="n">IsEnabled</span><span class="p">():</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_high</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_high</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_high</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_state</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_enable_high_q_section</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Disable or enable some button if the user enable high q extrapolation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_bookmark_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_set_preview_flag</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_high_cbox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_high_tcl</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">power_law_high</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_high</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_high</span><span class="o">.</span><span class="n">Enable</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_high_tcl</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">power_law_high</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_high</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_high</span><span class="o">.</span><span class="n">Disable</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_enable_fit_power_law_high</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_state</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+ 
+    <span class="k">def</span> <span class="nf">_layout_extrapolation_high</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to extrapolation at high q range</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">enable_high_cbox</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                            <span class="s">&quot;Enable Extrapolate high-Q&quot;</span><span class="p">,</span>
+                                            <span class="n">name</span><span class="o">=</span><span class="s">&#39;enable_high_cbox&#39;</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="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">enable_high_cbox</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span>
+                                         <span class="bp">self</span><span class="o">.</span><span class="n">_enable_high_q_section</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_high</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Fix&#39;</span><span class="p">,</span>
+                                         <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</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">RB_GROUP</span><span class="p">,</span>
+                                         <span class="n">name</span><span class="o">=</span><span class="s">&#39;fix_enable_high&#39;</span><span class="p">)</span>
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_enable_fit_power_law_high</span><span class="p">,</span>
+                                     <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_high</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_high</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Fit&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                              <span class="n">name</span><span class="o">=</span><span class="s">&#39;fit_enable_high&#39;</span><span class="p">)</span>     
+        <span class="bp">self</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_RADIOBUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_enable_fit_power_law_high</span><span class="p">,</span> 
+                                        <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_high</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">power_law_high</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Power Law&#39;</span><span class="p">)</span>
+        <span class="n">msg_hint</span> <span class="o">=</span> <span class="s">&quot;Check to extrapolate data at high-Q&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">power_law_high</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">msg_hint</span><span class="p">)</span>
+        <span class="n">npts_high_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Npts&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_high_tcl</span> <span class="o">=</span> <span class="n">InvTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">2</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span>
+                                         <span class="n">name</span><span class="o">=</span><span class="s">&#39;npts_high_tcl&#39;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">npts_high_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_text</span><span class="p">)</span>
+        <span class="n">msg_hint</span> <span class="o">=</span> <span class="s">&quot;Number of Q points to consider&quot;</span>
+        <span class="n">msg_hint</span> <span class="o">+=</span> <span class="s">&quot;while extrapolating the high-Q region&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_high_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">msg_hint</span><span class="p">)</span>
+        <span class="n">power_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Power&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span> <span class="o">=</span> <span class="n">InvTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="o">*</span><span class="mi">2</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">name</span><span class="o">=</span><span class="s">&#39;power_high_tcl&#39;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_text</span><span class="p">)</span>
+        <span class="n">power_hint_txt</span> <span class="o">=</span> <span class="s">&quot;Exponent to apply to the Power_law function.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">power_hint_txt</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">enable_high_cbox</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">npts_high_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_high_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">power_law_high</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+       
+        <span class="c"># Parameter controls for power law</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fix_enable_high</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">fit_enable_high</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                           <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">1</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">power_txt</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_q_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">power_high_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span>  <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">high_extrapolation_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">high_q_sizer</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">BOTTOM</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_extrapolation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to extrapolation</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">extra_hint</span> <span class="o">=</span> <span class="s">&quot;Extrapolation </span><span class="se">\n</span><span class="s">Maximum Q Range [1/A]:&quot;</span>
+        <span class="n">extra_hint_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">extra_hint</span><span class="p">)</span>
+        <span class="c">#Extrapolation range [string]</span>
+        <span class="n">extrapolation_min_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Min:&#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_min_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                                <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
+                                                <span class="n">name</span><span class="o">=</span><span class="s">&#39;extrapolation_min_tcl&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_min_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">Q_MINIMUM</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;The minimum extrapolated q value.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_min_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="n">extrapolation_max_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Max:&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_max_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                  <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
+                                                  <span class="n">name</span><span class="o">=</span><span class="s">&#39;extrapolation_max_tcl&#39;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_max_tcl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">Q_MAXIMUM</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;The maximum extrapolated q value.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_max_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_range_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">extra_hint_txt</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                                <span class="p">(</span><span class="n">extrapolation_min_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_min_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                                <span class="p">(</span><span class="n">extrapolation_max_txt</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">LEFT</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_max_tcl</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">LEFT</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_extrapolation_low</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_extrapolation_high</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_low_high_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">(</span>\
+                                            <span class="p">[(</span><span class="bp">self</span><span class="o">.</span><span class="n">low_extrapolation_sizer</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">high_extrapolation_sizer</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_range_sizer</span><span class="p">),</span>
+                                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_low_high_sizer</span><span class="p">)])</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_volume_surface_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to volume and surface</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">unit_volume</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="n">unit_surface</span> <span class="o">=</span> <span class="s">&#39;[1/A]&#39;</span>
+        <span class="n">uncertainty</span> <span class="o">=</span> <span class="s">&quot;+/-&quot;</span> 
+        <span class="n">volume_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Volume Fraction&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span>
+                                         <span class="n">name</span><span class="o">=</span><span class="s">&#39;volume_tcl&#39;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">volume_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_out_text</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Volume fraction.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_err_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span>
+                                             <span class="n">name</span><span class="o">=</span><span class="s">&#39;volume_err_tcl&#39;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">volume_err_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_out_text</span><span class="p">)</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Uncertainty on the volume fraction.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_err_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="n">volume_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_volume</span><span class="p">)</span>
+        
+        <span class="n">surface_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Specific Surface&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">surface_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span>
+                                          <span class="n">name</span><span class="o">=</span><span class="s">&#39;surface_tcl&#39;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">surface_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_out_text</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">surface_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Specific surface value.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">surface_err_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span>
+                                              <span class="n">name</span><span class="o">=</span><span class="s">&#39;surface_err_tcl&#39;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">surface_err_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_out_text</span><span class="p">)</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Uncertainty on the specific surface.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">surface_err_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="n">surface_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_surface</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">volume_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">volume_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">uncertainty</span><span class="p">),</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">volume_err_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">volume_units_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">surface_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">surface_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">uncertainty</span><span class="p">),</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">surface_err_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">surface_units_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">static_line</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        
+    <span class="k">def</span> <span class="nf">_layout_invariant_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to invariant</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">uncertainty</span> <span class="o">=</span> <span class="s">&quot;+/-&quot;</span> 
+        <span class="n">unit_invariant</span> <span class="o">=</span> <span class="s">&#39;[1/(cm*A^3)]&#39;</span>
+        <span class="n">invariant_total_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Invariant Total [Q*]&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span>
+                                                  <span class="n">name</span><span class="o">=</span><span class="s">&#39;invariant_total_tcl&#39;</span><span class="p">)</span>
+        <span class="n">msg_hint</span> <span class="o">=</span> <span class="s">&quot;Total invariant [Q*], including extrapolated regions.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">msg_hint</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_err_tcl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                      <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span>
+                                                <span class="n">name</span><span class="o">=</span><span class="s">&#39;invariant_total_err_tcl&#39;</span><span class="p">)</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Uncertainty on invariant.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_err_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="n">invariant_total_units_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit_invariant</span><span class="p">,</span> 
+                                                  <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">80</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
+    
+        <span class="c">#Invariant total</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">invariant_total_txt</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">uncertainty</span><span class="p">),</span>
+                         <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span> 
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_total_err_tcl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                             <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">invariant_total_units_txt</span><span class="p">,(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                          <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+ 
+    <span class="k">def</span> <span class="nf">_layout_inputs_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to inputs</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">contrast_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Contrast:&#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">contrast_tcl</span> <span class="o">=</span> <span class="n">InvTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                        <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;contrast_tcl&#39;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">contrast_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_text</span><span class="p">)</span>
+        <span class="n">contrast_hint_txt</span> <span class="o">=</span> <span class="s">&quot;Contrast&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">contrast_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">contrast_hint_txt</span><span class="p">)</span>
+        <span class="n">contrast_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[1/A^2]&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>  
+        <span class="n">porod_const_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                        <span class="s">&#39;Porod</span><span class="se">\n</span><span class="s">Constant:</span><span class="se">\n</span><span class="s">(optional)</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>  
+        <span class="n">porod_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[1/(cm*A^4)]&#39;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">80</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">porod_constant_tcl</span> <span class="o">=</span> <span class="n">InvTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                              <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
+                                              <span class="n">name</span><span class="o">=</span><span class="s">&#39;porod_constant_tcl&#39;</span><span class="p">)</span> 
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">porod_constant_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_text</span><span class="p">)</span>
+        <span class="n">porod_const_hint_txt</span> <span class="o">=</span> <span class="s">&quot;Porod Constant&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">porod_constant_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">porod_const_hint_txt</span><span class="p">)</span>
+        
+        <span class="n">background_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Background:&#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">background_tcl</span> <span class="o">=</span> <span class="n">InvTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span>
+                                          <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&#39;background_tcl&#39;</span><span class="p">)</span> 
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">background_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_text</span><span class="p">)</span>
+        <span class="n">background_hint_txt</span> <span class="o">=</span> <span class="s">&quot;Background&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">background_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">background_hint_txt</span><span class="p">)</span>
+        <span class="n">background_unit_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;[1/cm]&#39;</span><span class="p">)</span>  
+        <span class="n">scale_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&#39;Scale:&#39;</span><span class="p">)</span>  
+        <span class="bp">self</span><span class="o">.</span><span class="n">scale_tcl</span> <span class="o">=</span> <span class="n">InvTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">_BOX_WIDTH</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
+                                     <span class="n">name</span><span class="o">=</span><span class="s">&#39;scale_tcl&#39;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_TEXT</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">scale_tcl</span><span class="o">.</span><span class="n">GetId</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_text</span><span class="p">)</span>
+        <span class="n">scale_hint_txt</span> <span class="o">=</span> <span class="s">&quot;Scale&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">scale_tcl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">scale_hint_txt</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sizer_input</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">background_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">background_tcl</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                            <span class="p">(</span><span class="n">background_unit_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                            <span class="p">(</span><span class="n">scale_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">scale_tcl</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                            <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                            <span class="p">(</span><span class="n">contrast_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                            <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">contrast_tcl</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                            <span class="p">(</span><span class="n">contrast_unit_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                            <span class="p">(</span><span class="n">porod_const_txt</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">LEFT</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">porod_constant_tcl</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span>
+                <span class="p">(</span><span class="n">porod_unit_txt</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">inputs_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sizer_input</span><span class="p">)</span>
+       
+    <span class="k">def</span> <span class="nf">_layout_outputs_sizer</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw widgets related to outputs</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_volume_surface_sizer</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_invariant_sizer</span><span class="p">()</span>
+        <span class="n">static_line</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">volume_surface_sizer</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">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                    <span class="p">(</span><span class="n">static_line</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">EXPAND</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
+                         <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">invariant_sizer</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">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_layout_button</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>  
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout for the button widgets</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="c">#compute button</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Compute&quot;</span><span class="p">,</span>
+                                          <span class="n">name</span><span class="o">=</span><span class="s">&#39;compute_invariant&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Compute invariant&quot;</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">compute_invariant</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>   
+        <span class="c">#detail button</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_details</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Details?&quot;</span><span class="p">)</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Details about the results of the computation&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_details</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">display_details</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">)</span>
+        <span class="n">details</span> <span class="o">=</span> <span class="s">&quot;Details on Invariant Total Calculations&quot;</span>
+        <span class="n">details_txt</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">details</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="n">details_txt</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">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_details</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                        <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_calculate</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">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Draw window content</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_define_structure</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_data_name</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_extrapolation</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_inputs_sizer</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_outputs_sizer</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_layout_button</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="o">.</span><span class="n">AddMany</span><span class="p">([(</span><span class="bp">self</span><span class="o">.</span><span class="n">data_name_boxsizer</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">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">outputs_sizer</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">button_sizer</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
+                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">inputs_sizer</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span>
+                                  <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">extrapolation_sizer</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">10</span><span class="p">)])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">main_sizer</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+        </div>
+<div class="viewcode-block" id="InvariantDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantDialog">[docs]</a><span class="k">class</span> <span class="nc">InvariantDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Invariant Dialog</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">graph</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Invariant&quot;</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span><span class="p">,</span>
+                                                             <span class="n">PANEL_HEIGHT</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">InvariantPanel</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="InvariantWindow"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.InvariantWindow">[docs]</a><span class="k">class</span> <span class="nc">InvariantWindow</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Invariant Window</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">graph</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                 <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Invariant&quot;</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        
+        <span class="n">wx</span><span class="o">.</span><span class="n">Frame</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">PANEL_WIDTH</span> <span class="o">+</span><span class="mi">100</span><span class="p">,</span>
+                                                             <span class="n">PANEL_HEIGHT</span><span class="o">+</span><span class="mi">100</span><span class="p">))</span>
+        <span class="kn">from</span> <span class="nn">sas.dataloader.loader</span> <span class="kn">import</span>  <span class="n">Loader</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">loader</span> <span class="o">=</span> <span class="n">Loader</span><span class="p">()</span>
+        <span class="kn">import</span> <span class="nn">invariant</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="s">&quot;C:/ECLPS/workspace/trunk/sasdataloader/test/ascii_test_3.txt&quot;</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">loader</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span> <span class="o">=</span> <span class="n">InvariantPanel</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+
+        <span class="n">data</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">filename</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">panel</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="MyApp"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.MyApp">[docs]</a><span class="k">class</span> <span class="nc">MyApp</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">App</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Test App</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+<div class="viewcode-block" id="MyApp.OnInit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_panel.MyApp.OnInit">[docs]</a>    <span class="k">def</span> <span class="nf">OnInit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Init</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">InitAllImageHandlers</span><span class="p">()</span>
+        <span class="n">frame</span> <span class="o">=</span> <span class="n">InvariantWindow</span><span class="p">()</span>
+        <span class="n">frame</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTopWindow</span><span class="p">(</span><span class="n">frame</span><span class="p">)</span>
+        
+        <span class="k">return</span> <span class="bp">True</span>
+      
+<span class="c"># end of class MyApp</span>
+</div></div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span>
+    <span class="n">app</span> <span class="o">=</span> <span class="n">MyApp</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+    <span class="n">app</span><span class="o">.</span><span class="n">MainLoop</span><span class="p">()</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" >sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/invariant/invariant_state.html
===================================================================
--- _modules/sas/perspectives/invariant/invariant_state.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/invariant/invariant_state.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,908 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.invariant.invariant_state &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.invariant" href="../invariant.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" accesskey="U">sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.invariant.invariant_state</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="c">#import time</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">logging</span>
+<span class="kn">import</span> <span class="nn">copy</span>
+<span class="kn">import</span> <span class="nn">sas.dataloader</span>
+<span class="c">#from xml.dom.minidom import parse</span>
+<span class="kn">from</span> <span class="nn">lxml</span> <span class="kn">import</span> <span class="n">etree</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.readers.cansas_reader</span> <span class="kn">import</span> <span class="n">Reader</span> <span class="k">as</span> <span class="n">CansasReader</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.readers.cansas_reader</span> <span class="kn">import</span> <span class="n">get_content</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.utils</span> <span class="kn">import</span> <span class="n">format_number</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.gui_style</span> <span class="kn">import</span> <span class="n">GUIFRAME_ID</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">Data1D</span>
+
+<span class="n">INVNODE_NAME</span> <span class="o">=</span> <span class="s">&#39;invariant&#39;</span>
+<span class="n">CANSAS_NS</span> <span class="o">=</span> <span class="s">&quot;cansas1d/1.0&quot;</span>
+
+<span class="c"># default state</span>
+<span class="nb">list</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;file&#39;</span><span class="p">:</span> <span class="s">&#39;None&#39;</span><span class="p">,</span>
+        <span class="s">&#39;compute_num&#39;</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span>
+        <span class="s">&#39;state_num&#39;</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span>
+        <span class="s">&#39;is_time_machine&#39;</span><span class="p">:</span><span class="bp">False</span><span class="p">,</span>
+        <span class="s">&#39;background_tcl&#39;</span><span class="p">:</span><span class="mf">0.0</span><span class="p">,</span>
+        <span class="s">&#39;scale_tcl&#39;</span><span class="p">:</span><span class="mf">1.0</span><span class="p">,</span>
+        <span class="s">&#39;contrast_tcl&#39;</span><span class="p">:</span><span class="mf">1.0</span><span class="p">,</span>
+        <span class="s">&#39;porod_constant_tcl&#39;</span><span class="p">:</span><span class="s">&#39;&#39;</span><span class="p">,</span>
+        <span class="s">&#39;npts_low_tcl&#39;</span><span class="p">:</span><span class="mi">10</span><span class="p">,</span>
+        <span class="s">&#39;npts_high_tcl&#39;</span><span class="p">:</span><span class="mi">10</span><span class="p">,</span>
+        <span class="s">&#39;power_high_tcl&#39;</span><span class="p">:</span><span class="mf">4.0</span><span class="p">,</span>
+        <span class="s">&#39;power_low_tcl&#39;</span><span class="p">:</span> <span class="mf">4.0</span><span class="p">,</span>
+        <span class="s">&#39;enable_high_cbox&#39;</span><span class="p">:</span><span class="bp">False</span><span class="p">,</span>
+        <span class="s">&#39;enable_low_cbox&#39;</span><span class="p">:</span><span class="bp">False</span><span class="p">,</span>
+        <span class="s">&#39;guinier&#39;</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span>
+        <span class="s">&#39;power_law_high&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
+        <span class="s">&#39;power_law_low&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
+        <span class="s">&#39;fit_enable_high&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
+        <span class="s">&#39;fit_enable_low&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
+        <span class="s">&#39;fix_enable_high&#39;</span><span class="p">:</span><span class="bp">True</span><span class="p">,</span>
+        <span class="s">&#39;fix_enable_low&#39;</span><span class="p">:</span><span class="bp">True</span><span class="p">,</span>
+        <span class="s">&#39;volume_tcl&#39;</span><span class="p">:</span><span class="s">&#39;&#39;</span><span class="p">,</span>
+        <span class="s">&#39;volume_err_tcl&#39;</span><span class="p">:</span><span class="s">&#39;&#39;</span><span class="p">,</span>
+        <span class="s">&#39;surface_tcl&#39;</span><span class="p">:</span><span class="s">&#39;&#39;</span><span class="p">,</span>
+        <span class="s">&#39;surface_err_tcl&#39;</span><span class="p">:</span><span class="s">&#39;&#39;</span><span class="p">}</span>
+<span class="c"># list of states: This list will be filled as panel </span>
+<span class="c"># init and the number of states increases</span>
+<span class="n">state_list</span> <span class="o">=</span> <span class="p">{}</span>
+<span class="n">bookmark_list</span> <span class="o">=</span> <span class="p">{}</span>
+<span class="c"># list of input parameters (will be filled up on panel init) used by __str__ </span>
+<span class="n">input_list</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;background_tcl&#39;</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span>
+        <span class="s">&#39;scale_tcl&#39;</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span>
+        <span class="s">&#39;contrast_tcl&#39;</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span>
+        <span class="s">&#39;porod_constant_tcl&#39;</span><span class="p">:</span><span class="s">&#39;&#39;</span><span class="p">,</span>
+        <span class="s">&#39;npts_low_tcl&#39;</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span>
+        <span class="s">&#39;npts_high_tcl&#39;</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span>
+        <span class="s">&#39;power_high_tcl&#39;</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span>
+        <span class="s">&#39;power_low_tcl&#39;</span><span class="p">:</span> <span class="mi">0</span><span class="p">}</span>  
+<span class="c"># list of output parameters (order sensitive) used by __str__    </span>
+<span class="n">output_list</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&quot;qstar_low&quot;</span><span class="p">,</span>      <span class="s">&quot;Q* from low Q extrapolation [1/(cm*A)]&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;qstar_low_err&quot;</span><span class="p">,</span>             <span class="s">&quot;dQ* from low Q extrapolation&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;qstar_low_percent&quot;</span><span class="p">,</span>  <span class="s">&quot;Q* percent from low Q extrapolation&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;qstar&quot;</span><span class="p">,</span>              <span class="s">&quot;Q* from data [1/(cm*A)]&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;qstar_err&quot;</span><span class="p">,</span>                                <span class="s">&quot;dQ* from data&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;qstar_percent&quot;</span><span class="p">,</span>                     <span class="s">&quot;Q* percent from data&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;qstar_high&quot;</span><span class="p">,</span>    <span class="s">&quot;Q* from high Q extrapolation [1/(cm*A)]&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;qstar_high_err&quot;</span><span class="p">,</span>           <span class="s">&quot;dQ* from high Q extrapolation&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;qstar_high_percent&quot;</span><span class="p">,</span> <span class="s">&quot;Q* percent from low Q extrapolation&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;qstar_total&quot;</span><span class="p">,</span>         <span class="s">&quot;total Q* [1/(cm*A)]&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;qstar_total_err&quot;</span><span class="p">,</span>                              <span class="s">&quot;total dQ*&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;volume&quot;</span><span class="p">,</span>                                 <span class="s">&quot;volume fraction&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;volume_err&quot;</span><span class="p">,</span>                       <span class="s">&quot;volume fraction error&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;surface&quot;</span><span class="p">,</span>                               <span class="s">&quot;specific surface&quot;</span><span class="p">],</span>
+               <span class="p">[</span><span class="s">&quot;surface_err&quot;</span><span class="p">,</span>                     <span class="s">&quot;specific surface error&quot;</span><span class="p">]]</span>
+
+   
+
+<div class="viewcode-block" id="InvariantState"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.InvariantState">[docs]</a><span class="k">class</span> <span class="nc">InvariantState</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Class to hold the state information of the InversionControl panel.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Default values</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Input </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">file</span>  <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="p">[],</span> <span class="n">y</span><span class="o">=</span><span class="p">[],</span> <span class="n">dx</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">dy</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">theory_lowQ</span> <span class="o">=</span>  <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="p">[],</span> <span class="n">y</span><span class="o">=</span><span class="p">[],</span> <span class="n">dy</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">theory_lowQ</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">theory_highQ</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="p">[],</span> <span class="n">y</span><span class="o">=</span><span class="p">[],</span> <span class="n">dy</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">theory_highQ</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+        <span class="c">#self.is_time_machine = False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">saved_state</span> <span class="o">=</span> <span class="nb">list</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_list</span> <span class="o">=</span> <span class="n">state_list</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bookmark_list</span> <span class="o">=</span> <span class="n">bookmark_list</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">input_list</span> <span class="o">=</span> <span class="n">input_list</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_list</span> <span class="o">=</span> <span class="n">output_list</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">compute_num</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_num</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;00:00:00&#39;</span><span class="p">,</span> <span class="s">&#39;00/00/0000&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">container</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">#plot image</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wximbmp</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># report_html strings</span>
+        <span class="kn">import</span> <span class="nn">sas.perspectives.invariant</span> <span class="kn">as</span> <span class="nn">invariant</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="n">invariant</span><span class="o">.</span><span class="n">get_data_path</span><span class="p">(</span><span class="n">media</span><span class="o">=</span><span class="s">&#39;media&#39;</span><span class="p">)</span>
+        <span class="n">path_report_html</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">path</span><span class="p">,</span><span class="s">&quot;report_template.html&quot;</span><span class="p">)</span>
+        <span class="n">html_template</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">path_report_html</span><span class="p">,</span><span class="s">&quot;r&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">template_str</span> <span class="o">=</span> <span class="n">html_template</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">report_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">template_str</span>
+        <span class="c">#self.report_str_save = None</span>
+        <span class="n">html_template</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Pretty print</span>
+<span class="sd">            </span>
+<span class="sd">        : return: string representing the state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Input string</span>
+        <span class="n">compute_num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;compute_num&#39;</span><span class="p">]</span>
+        <span class="n">compute_state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_list</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">compute_num</span><span class="p">)]</span>
+        <span class="n">my_time</span><span class="p">,</span> <span class="n">date</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span>
+        <span class="n">file_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">file</span>
+
+        <span class="n">state_num</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">])</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">[Invariant computation for </span><span class="si">%s</span><span class="s">: &quot;</span> <span class="o">%</span> <span class="n">file_name</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;performed at </span><span class="si">%s</span><span class="s"> on </span><span class="si">%s</span><span class="s">] </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">my_time</span><span class="p">,</span> <span class="n">date</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;State No.: </span><span class="si">%d</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">state_num</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">=== Inputs ===</span><span class="se">\n</span><span class="s">&quot;</span>
+        
+        <span class="c"># text ctl general inputs ( excluding extrapolation text ctl)</span>
+        <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">input_list</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span> 
+            <span class="k">if</span> <span class="n">value</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                <span class="k">continue</span>
+            <span class="n">key_split</span> <span class="o">=</span> <span class="n">key</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;_&#39;</span><span class="p">)</span> 
+            <span class="n">max_ind</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">key_split</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span>
+            <span class="k">if</span> <span class="n">key_split</span><span class="p">[</span><span class="n">max_ind</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;tcl&#39;</span><span class="p">:</span> 
+                <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+                <span class="k">if</span> <span class="n">key_split</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;low&#39;</span> <span class="ow">or</span> <span class="n">key_split</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;high&#39;</span><span class="p">:</span>
+                    <span class="k">continue</span>
+                <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">max_ind</span><span class="p">):</span>
+                    <span class="n">name</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">key_split</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span>
+                <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">:   </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="o">.</span><span class="n">lstrip</span><span class="p">(</span><span class="s">&quot; &quot;</span><span class="p">),</span> <span class="n">value</span><span class="p">)</span>
+                
+        <span class="c"># other input parameters       </span>
+        <span class="n">extra_lo</span> <span class="o">=</span> <span class="n">compute_state</span><span class="p">[</span><span class="s">&#39;enable_low_cbox&#39;</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">compute_state</span><span class="p">[</span><span class="s">&#39;enable_low_cbox&#39;</span><span class="p">]:</span>
+            <span class="k">if</span> <span class="n">compute_state</span><span class="p">[</span><span class="s">&#39;guinier&#39;</span><span class="p">]:</span>
+                <span class="n">extra_lo</span> <span class="o">=</span> <span class="s">&#39;Guinier&#39;</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">extra_lo</span> <span class="o">=</span> <span class="s">&#39;Power law&#39;</span>
+        <span class="n">extra_hi</span> <span class="o">=</span> <span class="n">compute_state</span><span class="p">[</span><span class="s">&#39;enable_high_cbox&#39;</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">compute_state</span><span class="p">[</span><span class="s">&#39;enable_high_cbox&#39;</span><span class="p">]:</span>
+            <span class="n">extra_hi</span> <span class="o">=</span> <span class="s">&#39;Power law&#39;</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">Extrapolation:  High=</span><span class="si">%s</span><span class="s">; Low=</span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span><span class="p">(</span><span class="n">extra_hi</span><span class="p">,</span> <span class="n">extra_lo</span><span class="p">)</span>   
+        <span class="n">low_off</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="n">high_off</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">input_list</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span> 
+            <span class="n">key_split</span> <span class="o">=</span> <span class="n">key</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;_&#39;</span><span class="p">)</span> 
+            <span class="n">max_ind</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">key_split</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span>   
+            <span class="k">if</span> <span class="n">key_split</span><span class="p">[</span><span class="n">max_ind</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;tcl&#39;</span><span class="p">:</span> 
+                <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;&quot;</span> 
+                <span class="c"># check each buttons whether or not ON or OFF</span>
+                <span class="k">if</span> <span class="n">key_split</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;low&#39;</span> <span class="ow">or</span> <span class="n">key_split</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;high&#39;</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="n">compute_state</span><span class="p">[</span><span class="s">&#39;enable_low_cbox&#39;</span><span class="p">]</span> <span class="ow">and</span> \
+                        <span class="n">key_split</span><span class="p">[</span><span class="n">max_ind</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;low&#39;</span><span class="p">:</span>
+                        <span class="n">low_off</span> <span class="o">=</span> <span class="bp">True</span>
+                        <span class="k">continue</span>              
+                    <span class="k">elif</span> <span class="ow">not</span> <span class="n">compute_state</span><span class="p">[</span><span class="s">&#39;enable_high_cbox&#39;</span><span class="p">]</span> <span class="ow">and</span> \
+                        <span class="n">key_split</span><span class="p">[</span><span class="n">max_ind</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;high&#39;</span><span class="p">:</span>
+                        <span class="n">high_off</span> <span class="o">=</span> <span class="bp">True</span>
+                        <span class="k">continue</span>
+                    <span class="k">elif</span> <span class="n">extra_lo</span> <span class="o">==</span> <span class="s">&#39;Guinier&#39;</span> <span class="ow">and</span> <span class="n">key_split</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;power&#39;</span> <span class="ow">and</span> \
+                        <span class="n">key_split</span><span class="p">[</span><span class="n">max_ind</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;low&#39;</span><span class="p">:</span>
+                        <span class="k">continue</span>
+                    <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">max_ind</span><span class="p">):</span>
+                        <span class="n">name</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">key_split</span><span class="p">[</span><span class="n">ind</span><span class="p">]</span>
+                    <span class="n">name</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">lstrip</span><span class="p">(</span><span class="s">&quot; &quot;</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;power low&quot;</span> <span class="p">:</span>
+                        <span class="k">if</span> <span class="n">compute_state</span><span class="p">[</span><span class="s">&#39;fix_enable_low&#39;</span><span class="p">]:</span>
+                            <span class="n">name</span> <span class="o">+=</span> <span class="s">&#39; (Fixed)&#39;</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="n">name</span> <span class="o">+=</span> <span class="s">&#39; (Fitted)&#39;</span>
+                    <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&quot;power high&quot;</span> <span class="p">:</span>
+                        <span class="k">if</span> <span class="n">compute_state</span><span class="p">[</span><span class="s">&#39;fix_enable_high&#39;</span><span class="p">]:</span>
+                            <span class="n">name</span> <span class="o">+=</span> <span class="s">&#39; (Fixed)&#39;</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="n">name</span> <span class="o">+=</span> <span class="s">&#39; (Fitted)&#39;</span>
+                    <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">:   </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+        <span class="c"># Outputs</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">=== Outputs ===&quot;</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">output_list</span><span class="p">:</span>
+            <span class="n">item_split</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</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> 
+            <span class="c"># Exclude the extrapolation that turned off</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">item_split</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">low_off</span> <span class="ow">and</span> <span class="n">item_split</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;low&#39;</span><span class="p">:</span>
+                    <span class="k">continue</span>
+                <span class="k">if</span> <span class="n">high_off</span> <span class="ow">and</span> <span class="n">item_split</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;high&#39;</span><span class="p">:</span>
+                    <span class="k">continue</span>
+            <span class="n">max_ind</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">item_split</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="c"># Q* outputs</span>
+                <span class="k">exec</span> <span class="s">&quot;value = self.container.</span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="c"># other outputs than Q*</span>
+                <span class="n">name</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot;_tcl&quot;</span>
+                <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">saved_state</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+                    <span class="k">exec</span> <span class="s">&quot;value = self.saved_state[&#39;</span><span class="si">%s</span><span class="s">&#39;]&quot;</span> <span class="o">%</span> <span class="n">name</span>
+                
+            <span class="c"># Exclude the outputs w/&#39;&#39;    </span>
+            <span class="k">if</span> <span class="n">value</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                <span class="k">continue</span>    
+            <span class="c"># Error outputs</span>
+            <span class="k">if</span> <span class="n">item_split</span><span class="p">[</span><span class="n">max_ind</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;err&#39;</span><span class="p">:</span>
+                <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;+- </span><span class="si">%s</span><span class="s"> &quot;</span> <span class="o">%</span> <span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+            <span class="c"># Percentage outputs</span>
+            <span class="k">elif</span> <span class="n">item_split</span><span class="p">[</span><span class="n">max_ind</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;percent&#39;</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">value</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="o">*</span> <span class="mi">100</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>
+                <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;(</span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s">)&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">),</span> <span class="s">&#39;%&#39;</span><span class="p">)</span>
+            <span class="c"># Outputs</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="si">%s</span><span class="s">:   </span><span class="si">%s</span><span class="s"> &quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> 
+                                        <span class="n">format_number</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">high</span><span class="o">=</span><span class="bp">True</span><span class="p">))</span>
+        <span class="c"># Include warning msg</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">container</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="se">\n\n</span><span class="s">Note:</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">container</span><span class="o">.</span><span class="n">warning_msg</span>
+        <span class="k">return</span> <span class="n">state</span>
+
+<div class="viewcode-block" id="InvariantState.clone_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.InvariantState.clone_state">[docs]</a>    <span class="k">def</span> <span class="nf">clone_state</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        deepcopy the state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">saved_state</span><span class="p">)</span>
+</div>
+<div class="viewcode-block" id="InvariantState.toXML"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.InvariantState.toXML">[docs]</a>    <span class="k">def</span> <span class="nf">toXML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">file</span><span class="o">=</span><span class="s">&quot;inv_state.inv&quot;</span><span class="p">,</span> <span class="n">doc</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">entry_node</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Writes the state of the InversionControl panel to file, as XML.</span>
+<span class="sd">        </span>
+<span class="sd">        Compatible with standalone writing, or appending to an</span>
+<span class="sd">        already existing XML document. In that case, the XML document</span>
+<span class="sd">        is required. An optional entry node in the XML document </span>
+<span class="sd">        may also be given.</span>
+<span class="sd">        </span>
+<span class="sd">        : param file: file to write to</span>
+<span class="sd">        : param doc: XML document object [optional]</span>
+<span class="sd">        : param entry_node: XML node within the XML document at which we will append the data [optional]</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># TODO: Get this to work</span>
+        <span class="kn">from</span> <span class="nn">xml.dom.minidom</span> <span class="kn">import</span> <span class="n">getDOMImplementation</span>
+        <span class="kn">import</span> <span class="nn">time</span>
+        <span class="n">timestamp</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        <span class="c"># Check whether we have to write a standalone XML file</span>
+        <span class="k">if</span> <span class="n">doc</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">impl</span> <span class="o">=</span> <span class="n">getDOMImplementation</span><span class="p">()</span>
+        
+            <span class="n">doc_type</span> <span class="o">=</span> <span class="n">impl</span><span class="o">.</span><span class="n">createDocumentType</span><span class="p">(</span><span class="n">INVNODE_NAME</span><span class="p">,</span> <span class="s">&quot;1.0&quot;</span><span class="p">,</span> <span class="s">&quot;1.0&quot;</span><span class="p">)</span>     
+        
+            <span class="n">newdoc</span> <span class="o">=</span> <span class="n">impl</span><span class="o">.</span><span class="n">createDocument</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="n">INVNODE_NAME</span><span class="p">,</span> <span class="n">doc_type</span><span class="p">)</span>
+            <span class="n">top_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">documentElement</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># We are appending to an existing document</span>
+            <span class="n">newdoc</span> <span class="o">=</span> <span class="n">doc</span>
+            <span class="n">top_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">INVNODE_NAME</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">entry_node</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">newdoc</span><span class="o">.</span><span class="n">documentElement</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">top_element</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">entry_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">top_element</span><span class="p">)</span>
+                
+        <span class="n">attr</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createAttribute</span><span class="p">(</span><span class="s">&quot;version&quot;</span><span class="p">)</span>
+        <span class="n">attr</span><span class="o">.</span><span class="n">nodeValue</span> <span class="o">=</span> <span class="s">&#39;1.0&#39;</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">setAttributeNode</span><span class="p">(</span><span class="n">attr</span><span class="p">)</span>
+        
+        <span class="c"># File name</span>
+        <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;filename&quot;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="o">!=</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">file</span><span class="p">)))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="nb">file</span><span class="p">)))</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+        
+        <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;timestamp&quot;</span><span class="p">)</span>
+        <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">ctime</span><span class="p">(</span><span class="n">timestamp</span><span class="p">)))</span>
+        <span class="n">attr</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createAttribute</span><span class="p">(</span><span class="s">&quot;epoch&quot;</span><span class="p">)</span>
+        <span class="n">attr</span><span class="o">.</span><span class="n">nodeValue</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">timestamp</span><span class="p">)</span>
+        <span class="n">element</span><span class="o">.</span><span class="n">setAttributeNode</span><span class="p">(</span><span class="n">attr</span><span class="p">)</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+        
+        <span class="c"># Current state</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;state&quot;</span><span class="p">)</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+        
+        <span class="k">for</span> <span class="n">name</span><span class="p">,</span><span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">saved_state</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">))</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span>
+            <span class="n">state</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+              
+        <span class="c"># State history list</span>
+        <span class="n">history</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;history&quot;</span><span class="p">)</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">history</span><span class="p">)</span>
+        
+        <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_list</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">history_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&#39;state_&#39;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">))</span>
+            <span class="k">for</span> <span class="n">state_name</span><span class="p">,</span><span class="n">state_value</span> <span class="ow">in</span> <span class="n">value</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="n">state_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">state_name</span><span class="p">))</span>
+                <span class="n">child</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">state_value</span><span class="p">))</span>
+                <span class="n">state_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">child</span><span class="p">)</span>
+                <span class="n">history_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">state_element</span><span class="p">)</span>
+            <span class="c">#history_element.appendChild(state_list_element)</span>
+            <span class="n">history</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">history_element</span><span class="p">)</span>
+
+        <span class="c"># Bookmarks  bookmark_list[self.bookmark_num] = [\</span>
+        <span class="c">#my_time,date,state,comp_state]</span>
+        <span class="n">bookmark</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;bookmark&quot;</span><span class="p">)</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">bookmark</span><span class="p">)</span>
+        <span class="n">item_list</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;time&#39;</span><span class="p">,</span><span class="s">&#39;date&#39;</span><span class="p">,</span><span class="s">&#39;state&#39;</span><span class="p">,</span><span class="s">&#39;comp_state&#39;</span><span class="p">]</span>
+        <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">value_list</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">bookmark_list</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+            <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&#39;mark_&#39;</span><span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">name</span><span class="p">))</span>
+            <span class="n">_</span><span class="p">,</span><span class="n">date</span><span class="p">,</span><span class="n">state</span><span class="p">,</span><span class="n">comp_state</span> <span class="o">=</span> <span class="n">value_list</span>
+            <span class="n">time_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&#39;time&#39;</span><span class="p">)</span>
+            <span class="n">time_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">value_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])))</span>
+            <span class="n">date_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&#39;date&#39;</span><span class="p">)</span>
+            <span class="n">date_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">value_list</span><span class="p">[</span><span class="mi">1</span><span class="p">])))</span>
+            <span class="n">state_list_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&#39;state&#39;</span><span class="p">)</span>
+            <span class="n">comp_state_list_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&#39;comp_state&#39;</span><span class="p">)</span>
+            <span class="k">for</span> <span class="n">state_name</span><span class="p">,</span> <span class="n">state_value</span> <span class="ow">in</span> <span class="n">value_list</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="n">state_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">state_name</span><span class="p">))</span>
+                <span class="n">child</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">state_value</span><span class="p">))</span>
+                <span class="n">state_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">child</span><span class="p">)</span>
+                <span class="n">state_list_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">state_element</span><span class="p">)</span>
+            <span class="k">for</span> <span class="n">comp_name</span><span class="p">,</span> <span class="n">comp_value</span> <span class="ow">in</span> <span class="n">value_list</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="o">.</span><span class="n">iteritems</span><span class="p">():</span>
+                <span class="n">comp_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">comp_name</span><span class="p">))</span>
+                <span class="n">comp_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">comp_value</span><span class="p">)))</span>
+                <span class="n">comp_state_list_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">comp_element</span><span class="p">)</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">time_element</span><span class="p">)</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">date_element</span><span class="p">)</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">state_list_element</span><span class="p">)</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">comp_state_list_element</span><span class="p">)</span>
+            <span class="n">bookmark</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+
+        <span class="c"># Save the file</span>
+        <span class="k">if</span> <span class="n">doc</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">fd</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">&#39;test000&#39;</span><span class="p">,</span> <span class="s">&#39;w&#39;</span><span class="p">)</span>
+            <span class="n">fd</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">toprettyxml</span><span class="p">())</span>
+            <span class="n">fd</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">newdoc</span>
+        </div>
+<div class="viewcode-block" id="InvariantState.fromXML"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.InvariantState.fromXML">[docs]</a>    <span class="k">def</span> <span class="nf">fromXML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">file</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">node</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Load invariant states from a file</span>
+<span class="sd">            </span>
+<span class="sd">        : param file: .inv file</span>
+<span class="sd">        : param node: node of a XML document to read from       </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">file</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;InvariantSate no longer supports non-CanSAS&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; format for invariant files&quot;</span>
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">msg</span>
+        
+        <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;version&#39;</span><span class="p">)</span>\
+            <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;version&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="s">&#39;1.0&#39;</span><span class="p">:</span>
+
+            <span class="c"># Get file name</span>
+            <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:filename&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">file_name</span> <span class="o">=</span> <span class="n">entry</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+
+            <span class="c"># Get time stamp</span>
+            <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:timestamp&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">entry</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;epoch&#39;</span><span class="p">):</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">timestamp</span> <span class="o">=</span> <span class="p">(</span><span class="n">entry</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;epoch&#39;</span><span class="p">))</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;InvariantSate.fromXML: Could not read&quot;</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; timestamp</span><span class="se">\n</span><span class="s"> </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                    <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+            
+            <span class="c"># Parse bookmarks</span>
+            <span class="n">entry_bookmark</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:bookmark&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>
+
+            <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">entry_bookmark</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">):</span>
+                <span class="n">temp_state</span> <span class="o">=</span> <span class="p">{}</span>
+                <span class="n">temp_bookmark</span> <span class="o">=</span> <span class="p">{}</span>
+                <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:mark_</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">ind</span><span class="p">,</span> <span class="n">entry_bookmark</span><span class="p">)</span> 
+                                
+                <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="n">my_time</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:time&#39;</span><span class="p">,</span> <span class="n">entry</span><span class="p">)</span>
+                    <span class="n">val_time</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">my_time</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
+                    <span class="n">date</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:date&#39;</span><span class="p">,</span> <span class="n">entry</span><span class="p">)</span>
+                    <span class="n">val_date</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">date</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
+                    <span class="n">state_entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:state&#39;</span><span class="p">,</span> <span class="n">entry</span><span class="p">)</span>
+                    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">:</span>
+
+                        <span class="n">input_field</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">,</span> <span class="n">state_entry</span><span class="p">)</span>
+                        <span class="n">val</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">input_field</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
+                        <span class="k">if</span> <span class="n">input_field</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                            <span class="k">try</span><span class="p">:</span>
+                                <span class="k">exec</span> <span class="s">&quot;temp_state[&#39;</span><span class="si">%s</span><span class="s">&#39;] = </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span>      
+                            <span class="k">except</span><span class="p">:</span>
+                                <span class="k">exec</span> <span class="s">&quot;temp_state[&#39;</span><span class="si">%s</span><span class="s">&#39;] = &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span>
+                    <span class="n">comp_entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:comp_state&#39;</span><span class="p">,</span> <span class="n">entry</span><span class="p">)</span>
+                    
+                    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">:</span>
+                        <span class="n">input_field</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">,</span> <span class="n">comp_entry</span><span class="p">)</span>
+                        <span class="n">val</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">input_field</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
+                        <span class="k">if</span> <span class="n">input_field</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                            <span class="k">try</span><span class="p">:</span>
+                                <span class="k">exec</span> <span class="s">&quot;temp_bookmark[&#39;</span><span class="si">%s</span><span class="s">&#39;] = </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span>      
+                            <span class="k">except</span><span class="p">:</span>
+                                <span class="k">exec</span> <span class="s">&quot;temp_bookmark[&#39;</span><span class="si">%s</span><span class="s">&#39;] = &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span>
+                    <span class="k">try</span><span class="p">:</span>
+                        <span class="n">cmd</span> <span class="o">=</span> <span class="s">&quot;self.bookmark_list[</span><span class="si">%s</span><span class="s">] = [val_time,&quot;</span>
+                        <span class="n">cmd</span> <span class="o">+=</span> <span class="s">&quot;val_date,temp_state,temp_bookmark]&quot;</span>
+                        <span class="k">exec</span> <span class="n">cmd</span> <span class="o">%</span> <span class="n">ind</span>
+                    <span class="k">except</span><span class="p">:</span>
+                        <span class="k">raise</span> <span class="s">&quot;missing components of bookmarks...&quot;</span>
+            <span class="c"># Parse histories</span>
+            <span class="n">entry_history</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:history&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>
+
+            <span class="k">for</span> <span class="n">ind</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">entry_history</span><span class="p">)):</span>
+                <span class="n">temp_state</span> <span class="o">=</span> <span class="p">{}</span>
+                <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:state_</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">ind</span><span class="p">,</span> <span class="n">entry_history</span><span class="p">)</span> 
+
+                <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">:</span>
+                        <span class="n">input_field</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">,</span> <span class="n">entry</span> <span class="p">)</span>
+                        <span class="n">val</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">input_field</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
+
+                        <span class="k">if</span> <span class="n">input_field</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                            <span class="k">try</span><span class="p">:</span>
+                                <span class="k">exec</span> <span class="s">&quot;temp_state[&#39;</span><span class="si">%s</span><span class="s">&#39;] = </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span>         
+                            <span class="k">except</span><span class="p">:</span>
+                                <span class="k">exec</span> <span class="s">&quot;temp_state[&#39;</span><span class="si">%s</span><span class="s">&#39;] = &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span>
+                            <span class="k">finally</span><span class="p">:</span>
+                                <span class="k">exec</span> <span class="s">&quot;self.state_list[&#39;</span><span class="si">%s</span><span class="s">&#39;] = temp_state&quot;</span> <span class="o">%</span> <span class="n">ind</span> 
+            <span class="c"># Parse current state (ie, saved_state)</span>
+            <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:state&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>           
+            <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">:</span>
+                    <span class="n">input_field</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">,</span> <span class="n">entry</span><span class="p">)</span>
+                    <span class="n">val</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">input_field</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
+                    <span class="k">if</span> <span class="n">input_field</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">set_saved_state</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">item</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">val</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="n">file_name</span>
+            </div>
+<div class="viewcode-block" id="InvariantState.set_report_string"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.InvariantState.set_report_string">[docs]</a>    <span class="k">def</span> <span class="nf">set_report_string</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the values (strings) from __str__ for report </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">strings</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__str__</span><span class="p">()</span>
+    
+        <span class="c"># default string values</span>
+        <span class="k">for</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">range</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">19</span><span class="p">):</span>
+            <span class="k">exec</span> <span class="s">&quot;s_</span><span class="si">%s</span><span class="s"> = &#39;NA&#39;&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">num</span><span class="p">)</span>
+        <span class="n">lines</span> <span class="o">=</span> <span class="n">strings</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
+        <span class="c"># get all string values from __str__()</span>
+        <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)):</span>
+            <span class="k">if</span> <span class="n">line</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="n">s_1</span> <span class="o">=</span> <span class="n">lines</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            <span class="k">elif</span> <span class="n">line</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
+                <span class="n">s_2</span> <span class="o">=</span> <span class="n">lines</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">item</span> <span class="o">=</span> <span class="n">lines</span><span class="p">[</span><span class="n">line</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>
+                <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;scale&quot;</span><span class="p">:</span>
+                    <span class="n">s_3</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;porod constant&quot;</span><span class="p">:</span>
+                    <span class="n">s_4</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;background&quot;</span><span class="p">:</span>
+                    <span class="n">s_5</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;contrast&quot;</span><span class="p">:</span>
+                    <span class="n">s_6</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;Extrapolation&quot;</span><span class="p">:</span>
+                    <span class="n">extra</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;;&quot;</span><span class="p">)</span>
+                    <span class="n">bool_0</span> <span class="o">=</span> <span class="n">extra</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;=&quot;</span><span class="p">)</span>
+                    <span class="n">bool_1</span> <span class="o">=</span> <span class="n">extra</span><span class="p">[</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">&quot;=&quot;</span><span class="p">)</span>
+                    <span class="n">s_8</span> <span class="o">=</span> <span class="s">&quot; &quot;</span> <span class="o">+</span> <span class="n">bool_0</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot;Q region = &quot;</span> <span class="o">+</span> <span class="n">bool_0</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                    <span class="n">s_7</span> <span class="o">=</span> <span class="s">&quot; &quot;</span> <span class="o">+</span> <span class="n">bool_1</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot;Q region = &quot;</span> <span class="o">+</span> <span class="n">bool_1</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;npts low&quot;</span><span class="p">:</span>
+                    <span class="n">s_9</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;npts high&quot;</span><span class="p">:</span>
+                    <span class="n">s_10</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;volume fraction&quot;</span><span class="p">:</span>
+                    <span class="n">val</span><span class="o">=</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">error</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">s_17</span> <span class="o">=</span> <span class="n">val</span> <span class="o">+</span> <span class="s">&quot; &amp;plusmn; &quot;</span> <span class="o">+</span> <span class="n">error</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;specific surface&quot;</span><span class="p">:</span>
+                    <span class="n">val</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">error</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">s_18</span> <span class="o">=</span> <span class="n">val</span> <span class="o">+</span> <span class="s">&quot; &amp;plusmn; &quot;</span> <span class="o">+</span> <span class="n">error</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;(&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;power low&quot;</span><span class="p">:</span>
+                    <span class="n">s_11</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">+</span><span class="s">&quot; =&quot;</span><span class="o">+</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;(&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;power high&quot;</span><span class="p">:</span>
+                    <span class="n">s_12</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">+</span><span class="s">&quot; =&quot;</span><span class="o">+</span><span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;[&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;Q* from low Q extrapolation&quot;</span><span class="p">:</span>
+                    <span class="c">#looks messy but this way the symbols +_ and % work on html</span>
+                    <span class="n">val</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">error</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">err</span> <span class="o">=</span> <span class="n">error</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;%&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">percent</span> <span class="o">=</span> <span class="n">error</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;%&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">s_13</span> <span class="o">=</span> <span class="n">val</span> <span class="o">+</span> <span class="s">&quot; &amp;plusmn; &quot;</span> <span class="o">+</span> <span class="n">err</span> <span class="o">+</span> <span class="s">&quot;&amp;#37&quot;</span> <span class="o">+</span> <span class="n">percent</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;[&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;Q* from data&quot;</span><span class="p">:</span>
+                    <span class="n">val</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">error</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">err</span> <span class="o">=</span> <span class="n">error</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;%&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">percent</span> <span class="o">=</span> <span class="n">error</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;%&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">s_14</span> <span class="o">=</span> <span class="n">val</span> <span class="o">+</span> <span class="s">&quot; &amp;plusmn; &quot;</span> <span class="o">+</span> <span class="n">err</span> <span class="o">+</span> <span class="s">&quot;&amp;#37&quot;</span> <span class="o">+</span> <span class="n">percent</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;[&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;Q* from high Q extrapolation&quot;</span><span class="p">:</span>
+                    <span class="n">val</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">error</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">err</span> <span class="o">=</span> <span class="n">error</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;%&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">percent</span> <span class="o">=</span> <span class="n">error</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;%&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">s_15</span> <span class="o">=</span> <span class="n">val</span> <span class="o">+</span> <span class="s">&quot; &amp;plusmn; &quot;</span> <span class="o">+</span> <span class="n">err</span> <span class="o">+</span> <span class="s">&quot;&amp;#37&quot;</span> <span class="o">+</span> <span class="n">percent</span>
+                <span class="k">elif</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;[&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;total Q*&quot;</span><span class="p">:</span>
+                    <span class="n">val</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">error</span> <span class="o">=</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;+-&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                    <span class="n">s_16</span> <span class="o">=</span> <span class="n">val</span> <span class="o">+</span> <span class="s">&quot; &amp;plusmn; &quot;</span> <span class="o">+</span> <span class="n">error</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="k">continue</span>
+
+        <span class="n">s_1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_html_format</span><span class="p">(</span><span class="n">s_1</span><span class="p">)</span>
+        <span class="n">file_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_html_format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">file</span><span class="p">)</span>
+
+        <span class="c"># make plot image</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_plot_state</span><span class="p">(</span><span class="n">extra_high</span><span class="o">=</span><span class="n">bool_0</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span><span class="n">extra_low</span><span class="o">=</span><span class="n">bool_1</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+        <span class="c"># get ready for report with setting all the html strings</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">report_str</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">template_str</span><span class="p">)</span> <span class="o">%</span> <span class="p">(</span><span class="n">s_1</span><span class="p">,</span> <span class="n">s_2</span><span class="p">,</span>
+                                        <span class="n">s_3</span><span class="p">,</span> <span class="n">s_4</span><span class="p">,</span> <span class="n">s_5</span><span class="p">,</span> <span class="n">s_6</span><span class="p">,</span> <span class="n">s_7</span><span class="p">,</span> <span class="n">s_8</span><span class="p">,</span>
+                                    <span class="n">s_9</span><span class="p">,</span> <span class="n">s_10</span><span class="p">,</span> <span class="n">s_11</span><span class="p">,</span> <span class="n">s_12</span><span class="p">,</span> <span class="n">s_13</span><span class="p">,</span> <span class="n">s_14</span><span class="p">,</span> <span class="n">s_15</span><span class="p">,</span>
+                                        <span class="n">s_16</span><span class="p">,</span> <span class="n">s_17</span><span class="p">,</span> <span class="n">s_18</span><span class="p">,</span> <span class="n">file_name</span><span class="p">,</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">&quot;</span><span class="p">)</span>
+</div>
+    <span class="k">def</span> <span class="nf">_check_html_format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check string &#39;%&#39; for html format</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;%&#39;</span><span class="p">):</span>
+            <span class="n">name</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&#39;%&#39;</span><span class="p">,</span> <span class="s">&#39;&amp;#37&#39;</span><span class="p">)</span>
+        
+        <span class="k">return</span> <span class="n">name</span>
+        
+<div class="viewcode-block" id="InvariantState.set_saved_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.InvariantState.set_saved_state">[docs]</a>    <span class="k">def</span> <span class="nf">set_saved_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the state list </span>
+<span class="sd">                    </span>
+<span class="sd">        : param name: name of the state component</span>
+<span class="sd">        : param value: value of the state component</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">rb_list</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&#39;power_law_low&#39;</span><span class="p">,</span><span class="s">&#39;guinier&#39;</span><span class="p">],</span>
+                   <span class="p">[</span><span class="s">&#39;fit_enable_low&#39;</span><span class="p">,</span><span class="s">&#39;fix_enable_low&#39;</span><span class="p">],</span>
+                   <span class="p">[</span><span class="s">&#39;fit_enable_high&#39;</span><span class="p">,</span><span class="s">&#39;fix_enable_high&#39;</span><span class="p">]]</span>
+
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">value</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">value</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+                <span class="k">exec</span> <span class="s">&quot;self.</span><span class="si">%s</span><span class="s"> = &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+                <span class="k">exec</span> <span class="s">&quot;self.saved_state[&#39;</span><span class="si">%s</span><span class="s">&#39;] = &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">exec</span> <span class="s">&#39;self.</span><span class="si">%s</span><span class="s"> = </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+                <span class="k">exec</span> <span class="s">&quot;self.saved_state[&#39;</span><span class="si">%s</span><span class="s">&#39;] = </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+            <span class="c"># set the count part of radio button clicked </span>
+            <span class="c"># False for the saved_state</span>
+            <span class="k">for</span> <span class="n">title</span><span class="p">,</span> <span class="n">content</span> <span class="ow">in</span> <span class="n">rb_list</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">name</span> <span class="o">==</span>  <span class="n">title</span><span class="p">:</span>
+                    <span class="n">name</span> <span class="o">=</span> <span class="n">content</span> 
+                    <span class="n">value</span> <span class="o">=</span> <span class="bp">False</span>     
+                <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="n">content</span><span class="p">:</span>
+                    <span class="n">name</span> <span class="o">=</span> <span class="n">title</span>
+                    <span class="n">value</span> <span class="o">=</span> <span class="bp">False</span> 
+            <span class="k">exec</span> <span class="s">&quot;self.saved_state[&#39;</span><span class="si">%s</span><span class="s">&#39;] = &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>     
+            <span class="bp">self</span><span class="o">.</span><span class="n">state_num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">saved_state</span><span class="p">[</span><span class="s">&#39;state_num&#39;</span><span class="p">]</span>
+        <span class="k">except</span><span class="p">:</span>           
+            <span class="k">pass</span>
+</div>
+<div class="viewcode-block" id="InvariantState.set_plot_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.InvariantState.set_plot_state">[docs]</a>    <span class="k">def</span> <span class="nf">set_plot_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">extra_high</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">extra_low</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Build image state that wx.html understand</span>
+<span class="sd">        by plotting, putting it into wx.FileSystem image object</span>
+<span class="sd">        </span>
+<span class="sd">        : extrap_high,extra_low: low/high extrapolations</span>
+<span class="sd">        are possible extra-plots</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># some imports</span>
+        <span class="kn">import</span> <span class="nn">wx</span>
+        <span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="kn">as</span> <span class="nn">plt</span>
+        <span class="kn">from</span> <span class="nn">matplotlib.backends.backend_agg</span> <span class="kn">import</span> <span class="n">FigureCanvasAgg</span>
+
+        <span class="c">#we use simple plot, not plotpanel</span>
+        <span class="c">#make matlab figure</span>
+        <span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">()</span>
+        <span class="n">fig</span><span class="o">.</span><span class="n">set_facecolor</span><span class="p">(</span><span class="s">&#39;w&#39;</span><span class="p">)</span>
+        <span class="n">graph</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">111</span><span class="p">)</span>
+
+        <span class="c">#data plot</span>
+        <span class="n">graph</span><span class="o">.</span><span class="n">errorbar</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">y</span><span class="p">,</span> <span class="n">yerr</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">dy</span><span class="p">,</span> <span class="n">fmt</span><span class="o">=</span><span class="s">&#39;o&#39;</span><span class="p">)</span>
+        <span class="c">#low Q extrapolation fit plot</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">extra_low</span> <span class="o">==</span> <span class="s">&#39;False&#39;</span><span class="p">:</span>
+            <span class="n">graph</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">theory_lowQ</span><span class="o">.</span><span class="n">x</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">theory_lowQ</span><span class="o">.</span><span class="n">y</span><span class="p">)</span>
+        <span class="c">#high Q extrapolation fit plot</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">extra_high</span> <span class="o">==</span> <span class="s">&#39;False&#39;</span><span class="p">:</span>
+            <span class="n">graph</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">theory_highQ</span><span class="o">.</span><span class="n">x</span><span class="p">,</span><span class="bp">self</span><span class="o">.</span><span class="n">theory_highQ</span><span class="o">.</span><span class="n">y</span><span class="p">)</span>
+        <span class="n">graph</span><span class="o">.</span><span class="n">set_xscale</span><span class="p">(</span><span class="s">&quot;log&quot;</span><span class="p">,</span> <span class="n">nonposx</span><span class="o">=</span><span class="s">&#39;clip&#39;</span><span class="p">)</span>
+        <span class="n">graph</span><span class="o">.</span><span class="n">set_yscale</span><span class="p">(</span><span class="s">&quot;log&quot;</span><span class="p">,</span> <span class="n">nonposy</span><span class="o">=</span><span class="s">&#39;clip&#39;</span><span class="p">)</span>
+        <span class="n">graph</span><span class="o">.</span><span class="n">set_xlabel</span><span class="p">(</span><span class="s">&#39;$</span><span class="se">\\</span><span class="s">rm{Q}(</span><span class="se">\\</span><span class="s">AA^{-1})$&#39;</span><span class="p">,</span> <span class="n">fontsize</span> <span class="o">=</span> <span class="mi">12</span><span class="p">)</span>
+        <span class="n">graph</span><span class="o">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s">&#39;$</span><span class="se">\\</span><span class="s">rm{Intensity}(cm^{-1})$&#39;</span><span class="p">,</span> <span class="n">fontsize</span> <span class="o">=</span> <span class="mi">12</span><span class="p">)</span>
+        <span class="n">canvas</span> <span class="o">=</span> <span class="n">FigureCanvasAgg</span><span class="p">(</span><span class="n">fig</span><span class="p">)</span>
+        <span class="c">#actually make image</span>
+        <span class="n">canvas</span><span class="o">.</span><span class="n">draw</span><span class="p">()</span>
+        
+        <span class="c">#make python.Image object </span>
+        <span class="c">#size</span>
+        <span class="n">w</span><span class="p">,</span> <span class="n">h</span> <span class="o">=</span> <span class="n">canvas</span><span class="o">.</span><span class="n">get_width_height</span><span class="p">()</span>
+        <span class="c">#convert to wx.Image</span>
+        <span class="n">wximg</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">EmptyImage</span><span class="p">(</span><span class="n">w</span><span class="p">,</span><span class="n">h</span><span class="p">)</span>
+        <span class="c">#wxim.SetData(img.convert(&#39;RGB&#39;).tostring() ) </span>
+        <span class="n">wximg</span><span class="o">.</span><span class="n">SetData</span><span class="p">(</span><span class="n">canvas</span><span class="o">.</span><span class="n">tostring_rgb</span><span class="p">())</span> 
+        <span class="c">#get the dynamic image for the htmlwindow</span>
+        <span class="n">wximgbmp</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">BitmapFromImage</span><span class="p">(</span><span class="n">wximg</span><span class="p">)</span>
+        <span class="c">#store the image in wx.FileSystem Object </span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">FileSystem</span><span class="o">.</span><span class="n">AddHandler</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">MemoryFSHandler</span><span class="p">())</span>
+        <span class="c"># use wx.MemoryFSHandler</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">imgRAM</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MemoryFSHandler</span><span class="p">()</span>
+        <span class="c">#AddFile, image can be retrieved with &#39;memory:filename&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">imgRAM</span><span class="o">.</span><span class="n">AddFile</span><span class="p">(</span><span class="s">&#39;img_inv.png&#39;</span><span class="p">,</span> <span class="n">wximgbmp</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">BITMAP_TYPE_PNG</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">wximgbmp</span> <span class="o">=</span> <span class="s">&#39;memory:img_inv.png&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">image</span> <span class="o">=</span> <span class="n">fig</span>
+</div></div>
+<div class="viewcode-block" id="Reader"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.Reader">[docs]</a><span class="k">class</span> <span class="nc">Reader</span><span class="p">(</span><span class="n">CansasReader</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Class to load a .inv invariant file</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## File type</span>
+    <span class="n">type_name</span> <span class="o">=</span> <span class="s">&quot;Invariant&quot;</span>
+    
+    <span class="c">## Wildcards</span>
+    <span class="nb">type</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;Invariant file (*.inv)|*.inv&quot;</span><span class="p">,</span>
+            <span class="s">&quot;SASView file (*.svs)|*.svs&quot;</span><span class="p">]</span>
+    <span class="c">## List of allowed extensions</span>
+    <span class="n">ext</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;.inv&#39;</span><span class="p">,</span> <span class="s">&#39;.INV&#39;</span><span class="p">,</span> <span class="s">&#39;.svs&#39;</span><span class="p">,</span> <span class="s">&#39;SVS&#39;</span><span class="p">]</span>  
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">call_back</span><span class="p">,</span> <span class="n">cansas</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialize the call-back method to be called</span>
+<span class="sd">        after we load a file</span>
+<span class="sd">        </span>
+<span class="sd">        : param call_back: call-back method</span>
+<span class="sd">        : param cansas:  True = files will be written/read in CanSAS format</span>
+<span class="sd">                        False = write CanSAS format  </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Call back method to be executed after a file is read</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">call_back</span> <span class="o">=</span> <span class="n">call_back</span>
+        <span class="c">## CanSAS format flag</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cansas</span> <span class="o">=</span> <span class="n">cansas</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>
+
+<div class="viewcode-block" id="Reader.read"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.Reader.read">[docs]</a>    <span class="k">def</span> <span class="nf">read</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Load a new invariant state from file</span>
+<span class="sd">        </span>
+<span class="sd">        : param path: file path</span>
+<span class="sd">        : return: None</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cansas</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_read_cansas</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_read_standalone</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_read_standalone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Load a new invariant state from file.</span>
+<span class="sd">        The invariant node is assumed to be the top element.</span>
+<span class="sd">        </span>
+<span class="sd">        : param path: file path</span>
+<span class="sd">        : return: None</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Read the new state from file</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="n">InvariantState</span><span class="p">()</span>
+
+        <span class="n">state</span><span class="o">.</span><span class="n">fromXML</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="n">path</span><span class="p">)</span>
+        
+        <span class="c"># Call back to post the new state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">call_back</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">None</span>
+    
+    <span class="k">def</span> <span class="nf">_parse_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">entry</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Read an invariant result from an XML node</span>
+<span class="sd">        </span>
+<span class="sd">        : param entry: XML node to read from </span>
+<span class="sd">        : return: InvariantState object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># Locate the invariant node</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">nodes</span> <span class="o">=</span> <span class="n">entry</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">INVNODE_NAME</span><span class="p">,</span>
+                                <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+            <span class="c"># Create an empty state</span>
+            <span class="k">if</span> <span class="n">nodes</span> <span class="o">!=</span> <span class="p">[]:</span>
+                <span class="n">state</span> <span class="o">=</span> <span class="n">InvariantState</span><span class="p">()</span>
+                <span class="n">state</span><span class="o">.</span><span class="n">fromXML</span><span class="p">(</span><span class="n">node</span><span class="o">=</span><span class="n">nodes</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;XML document does not contain invariant&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; information.</span><span class="se">\n</span><span class="s"> </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>  
+        <span class="k">return</span> <span class="n">state</span>
+    
+    <span class="k">def</span> <span class="nf">_read_cansas</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Load data and invariant information from a CanSAS XML file.</span>
+<span class="sd">        </span>
+<span class="sd">        : param path: file path</span>
+<span class="sd">        : return: Data1D object if a single SASentry was found, </span>
+<span class="sd">                    or a list of Data1D objects if multiple entries were found,</span>
+<span class="sd">                    or None of nothing was found</span>
+<span class="sd">        : raise RuntimeError: when the file can&#39;t be opened</span>
+<span class="sd">        : raise ValueError: when the length of the data vectors are inconsistent</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">output</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+            <span class="n">basename</span>  <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+            <span class="n">root</span><span class="p">,</span> <span class="n">extension</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+            
+            <span class="k">if</span>  <span class="n">extension</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="ow">or</span> \
+                <span class="n">extension</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;.xml&#39;</span><span class="p">:</span>
+                <span class="n">tree</span> <span class="o">=</span> <span class="n">etree</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">parser</span><span class="o">=</span><span class="n">etree</span><span class="o">.</span><span class="n">ETCompatXMLParser</span><span class="p">())</span>
+       
+                <span class="c"># Check the format version number</span>
+                <span class="c"># Specifying the namespace will take care of </span>
+                <span class="c"># the file format version </span>
+                <span class="n">root</span> <span class="o">=</span> <span class="n">tree</span><span class="o">.</span><span class="n">getroot</span><span class="p">()</span>
+                
+                <span class="n">entry_list</span> <span class="o">=</span> <span class="n">root</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;/ns:SASroot/ns:SASentry&#39;</span><span class="p">,</span>
+                                        <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+                
+                <span class="k">for</span> <span class="n">entry</span> <span class="ow">in</span> <span class="n">entry_list</span><span class="p">:</span>
+                    
+                    <span class="n">sas_entry</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_entry</span><span class="p">(</span><span class="n">entry</span><span class="p">)</span>
+                    <span class="n">invstate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_state</span><span class="p">(</span><span class="n">entry</span><span class="p">)</span>
+                    
+                    <span class="c">#invstate could be None when .svs file is loaded</span>
+                    <span class="c">#in this case, skip appending to output</span>
+                    <span class="k">if</span> <span class="n">invstate</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="n">sas_entry</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;invstate&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">invstate</span>
+                        <span class="n">sas_entry</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="n">invstate</span><span class="o">.</span><span class="n">file</span>
+                        <span class="n">output</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sas_entry</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> is not a file&quot;</span> <span class="o">%</span> <span class="n">path</span>
+
+        <span class="c"># Return output consistent with the loader&#39;s api</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">output</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">output</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="c"># Call back to post the new state</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="n">output</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;invstate&#39;</span><span class="p">]</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">call_back</span><span class="p">(</span><span class="n">state</span><span class="o">=</span><span class="n">output</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;invstate&#39;</span><span class="p">],</span>
+                          <span class="n">datainfo</span> <span class="o">=</span> <span class="n">output</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="k">return</span> <span class="n">output</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">output</span>                
+    
+<div class="viewcode-block" id="Reader.get_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.Reader.get_state">[docs]</a>    <span class="k">def</span> <span class="nf">get_state</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">state</span>
+    </div>
+<div class="viewcode-block" id="Reader.write"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.Reader.write">[docs]</a>    <span class="k">def</span> <span class="nf">write</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">invstate</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Write the content of a Data1D as a CanSAS XML file</span>
+<span class="sd">        </span>
+<span class="sd">        : param filename: name of the file to write</span>
+<span class="sd">        : param datainfo: Data1D object</span>
+<span class="sd">        : param invstate: InvariantState object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Sanity check</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cansas</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="n">doc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">write_toXML</span><span class="p">(</span><span class="n">datainfo</span><span class="p">,</span><span class="n">invstate</span><span class="p">)</span>
+            <span class="c"># Write the XML document</span>
+            <span class="n">fd</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>
+            <span class="n">fd</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">toprettyxml</span><span class="p">())</span>
+            <span class="n">fd</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">invstate</span><span class="o">.</span><span class="n">toXML</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="n">filename</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Reader.write_toXML"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_state.Reader.write_toXML">[docs]</a>    <span class="k">def</span> <span class="nf">write_toXML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Write toXML, a helper for write()</span>
+<span class="sd">        </span>
+<span class="sd">        : return: xml doc</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">datainfo</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">datainfo</span> <span class="o">=</span> <span class="n">sas</span><span class="o">.</span><span class="n">dataloader</span><span class="o">.</span><span class="n">data_info</span><span class="o">.</span><span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="p">[],</span> <span class="n">y</span><span class="o">=</span><span class="p">[])</span>    
+        <span class="k">elif</span> <span class="ow">not</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">sas</span><span class="o">.</span><span class="n">dataloader</span><span class="o">.</span><span class="n">data_info</span><span class="o">.</span><span class="n">Data1D</span><span class="p">):</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;The cansas writer expects a Data1D&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; instance: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">msg</span>
+        <span class="c">#make sure title and data run is filled up.</span>
+        <span class="k">if</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">title</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">title</span> <span class="o">==</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
+            <span class="n">datainfo</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">name</span>
+        <span class="k">if</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">run_name</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">run_name</span> <span class="o">==</span> <span class="p">{}:</span> 
+            <span class="n">datainfo</span><span class="o">.</span><span class="n">run</span> <span class="o">=</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">name</span><span class="p">)]</span>
+            <span class="n">datainfo</span><span class="o">.</span><span class="n">run_name</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">name</span>
+        <span class="c"># Create basic XML document</span>
+        <span class="n">doc</span><span class="p">,</span> <span class="n">sasentry</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_to_xml_doc</span><span class="p">(</span><span class="n">datainfo</span><span class="p">)</span>
+        <span class="c"># Add the invariant information to the XML document</span>
+        <span class="k">if</span> <span class="n">state</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">doc</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">toXML</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">name</span><span class="p">,</span><span class="n">doc</span><span class="o">=</span><span class="n">doc</span><span class="p">,</span> <span class="n">entry_node</span><span class="o">=</span><span class="n">sasentry</span><span class="p">)</span>
+        <span class="k">return</span> <span class="n">doc</span>
+</pre></div></div></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" >sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/invariant/invariant_widgets.html
===================================================================
--- _modules/sas/perspectives/invariant/invariant_widgets.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/invariant/invariant_widgets.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,266 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.invariant.invariant_widgets &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.invariant" href="../invariant.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" accesskey="U">sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.invariant.invariant_widgets</h1><div class="highlight"><pre>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation. </span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+
+
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">from</span> <span class="nn">wx.lib.scrolledpanel</span> <span class="kn">import</span> <span class="n">ScrolledPanel</span>
+
+<span class="n">WIDTH</span> <span class="o">=</span> <span class="mi">400</span>
+<span class="n">HEIGHT</span> <span class="o">=</span> <span class="mi">350</span>
+
+<span class="k">class</span> <span class="nc">DialogPanel</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">):</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+<div class="viewcode-block" id="DialogPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_widgets.DialogPanel">[docs]</a>        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        
+<span class="k">class</span> <span class="nc">InvTextCtrl</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Text control for model and fit parameters.</span></div>
+<div class="viewcode-block" id="InvTextCtrl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_widgets.InvTextCtrl">[docs]</a><span class="sd">    Binds the appropriate events for user interactions.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="c">## Set to True when the mouse is clicked while </span>
+        <span class="c">#the whole string is selected</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">## Call back for EVT_SET_FOCUS events</span>
+        <span class="n">_on_set_focus_callback</span> <span class="o">=</span> <span class="bp">None</span>
+
+        <span class="c"># Bind appropriate events</span>
+        <span class="bp">self</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_LEFT_UP</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_highlight_text</span><span class="p">)</span>
+        <span class="bp">self</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_SET_FOCUS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_set_focus</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_on_set_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Catch when the text control is set in focus to highlight the whole</span>
+<span class="sd">        text if necessary</span>
+<span class="sd">        </span>
+<span class="sd">        :param event: mouse event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span> <span class="o">=</span> <span class="bp">True</span>
+        
+    <span class="k">def</span> <span class="nf">_highlight_text</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Highlight text of a TextCtrl only of no text has be selected</span>
+<span class="sd">        </span>
+<span class="sd">        :param event: mouse event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Make sure the mouse event is available to other listeners</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">control</span>  <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="c"># Check that we have a TextCtrl</span>
+            <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">control</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span>
+                <span class="c"># Check whether text has been selected, </span>
+                <span class="c"># if not, select the whole string</span>
+                <span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> <span class="o">=</span> <span class="n">control</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">start</span> <span class="o">==</span> <span class="n">end</span><span class="p">:</span>
+                    <span class="n">control</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+           
+
+<span class="k">class</span> <span class="nc">OutputTextCtrl</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Text control used to display outputs.</span></div>
+<div class="viewcode-block" id="OutputTextCtrl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_widgets.OutputTextCtrl">[docs]</a><span class="sd">    No editing allowed. The background is </span>
+<span class="sd">    grayed out. User can&#39;t select text.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetParent</span><span class="p">()</span><span class="o">.</span><span class="n">GetBackgroundColour</span><span class="p">())</span>
+        
+        <span class="c"># Bind to mouse event to avoid text highlighting</span>
+        <span class="c"># The event will be skipped once the call-back</span>
+        <span class="c"># is called.</span>
+        
+        <span class="bp">self</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_MOUSE_EVENTS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_click</span><span class="p">)</span>
+
+        
+    <span class="k">def</span> <span class="nf">_click</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Prevent further handling of the mouse event</span>
+<span class="sd">        by not calling Skip().</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="k">pass</span>
+    
+<span class="k">class</span> <span class="nc">DataDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Allow file selection at loading time</span></div>
+<div class="viewcode-block" id="DataDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_widgets.DataDialog">[docs]</a><span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">WIDTH</span><span class="p">,</span> <span class="n">HEIGHT</span><span class="p">)</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Data Selection&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_of_ctrl</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_choice_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_panel</span> <span class="o">=</span> <span class="n">DialogPanel</span><span class="p">(</span><span class="bp">self</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">RAISED_BORDER</span><span class="p">,</span>
+                               <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">WIDTH</span><span class="o">-</span><span class="mi">20</span><span class="p">,</span> <span class="n">HEIGHT</span><span class="o">/</span><span class="mi">3</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">__do_layout</span><span class="p">(</span><span class="n">data_list</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="n">text</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">__do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        layout the dialog</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#add text</span>
+        <span class="k">if</span> <span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="n">text</span> <span class="o">=</span> <span class="s">&quot;This Perspective does not allow multiple data !</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">text</span> <span class="o">+=</span> <span class="s">&quot;Please select only one Data.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">text_ctrl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">text</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_MULTILINE</span><span class="p">,</span>
+                                <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">HEIGHT</span><span class="o">/</span><span class="mi">3</span><span class="p">))</span>
+        <span class="n">text_ctrl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">text_ctrl</span> <span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">rbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_panel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">data_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> 
+                                  <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</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">RB_GROUP</span><span class="p">)</span>
+        <span class="n">rbox</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_of_ctrl</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">rbox</span><span class="p">,</span> <span class="n">data_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_choice_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">rbox</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                         <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)):</span>
+            <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">rbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_panel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                  <span class="nb">str</span><span class="p">(</span><span class="n">data_list</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+            <span class="n">rbox</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">list_of_ctrl</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">rbox</span><span class="p">,</span> <span class="n">data_list</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_choice_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">rbox</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span>
+                           <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_panel</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_choice_sizer</span><span class="p">)</span>
+        <span class="c">#add sizer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">button_cancel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span> <span class="s">&quot;Cancel&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_cancel</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">button_OK</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">,</span> <span class="s">&quot;Ok&quot;</span><span class="p">)</span>
+        <span class="n">button_OK</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_OK</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">static_line</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_panel</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">static_line</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">EXPAND</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+        
+    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the selected data</span>
+<div class="viewcode-block" id="DataDialog.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.invariant_widgets.DataDialog.get_data">[docs]</a><span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">list_of_ctrl</span><span class="p">:</span>
+            <span class="n">rbox</span><span class="p">,</span> <span class="n">data</span> <span class="o">=</span> <span class="n">item</span>
+            <span class="k">if</span> <span class="n">rbox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="k">return</span> <span class="n">data</span> 
+
+    
+
+ 
+</pre></div></div></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" >sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/invariant/report_dialog.html
===================================================================
--- _modules/sas/perspectives/invariant/report_dialog.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/invariant/report_dialog.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,358 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.invariant.report_dialog &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="sas.perspectives.invariant" href="../invariant.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" accesskey="U">sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.invariant.report_dialog</h1><div class="highlight"><pre>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation. </span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Dialog report panel to show and summarize the results of </span>
+<span class="sd">the invariant calculation.</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">wx.html</span> <span class="kn">as</span> <span class="nn">html</span>
+<span class="n">ISPDF</span> <span class="o">=</span> <span class="bp">False</span>
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span> <span class="o">==</span> <span class="s">&quot;win32&quot;</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">450</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">500</span> 
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">700</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+    <span class="n">ISMAC</span> <span class="o">=</span> <span class="bp">False</span>
+    <span class="n">ISPDF</span> <span class="o">=</span> <span class="bp">True</span>
+<span class="k">elif</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span> <span class="o">==</span> <span class="s">&quot;darwin&quot;</span><span class="p">:</span>
+    <span class="n">_STATICBOX_WIDTH</span> <span class="o">=</span> <span class="mi">480</span>
+    <span class="n">PANEL_WIDTH</span> <span class="o">=</span> <span class="mi">530</span>
+    <span class="n">PANEL_HEIGHT</span> <span class="o">=</span> <span class="mi">700</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+    <span class="n">ISMAC</span> <span class="o">=</span> <span class="bp">True</span>
+    <span class="n">ISPDF</span> <span class="o">=</span> <span class="bp">True</span>
+  
+<span class="k">class</span> <span class="nc">ReportDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+<div class="viewcode-block" id="ReportDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.report_dialog.ReportDialog">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    The report dialog box. </span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>  <span class="nb">list</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialization. The parameters added to Dialog are:</span>
+<span class="sd">        </span>
+<span class="sd">        :param list: report_list (list of html_str, text_str, image)</span>
+<span class="sd">        from invariant_state</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;style&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RESIZE_BORDER</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">DEFAULT_DIALOG_STYLE</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;image&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;Dynamic Image&#39;</span>
+        <span class="c"># title</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="s">&quot;Report: Invariant computaion&quot;</span><span class="p">)</span>
+        <span class="c"># size</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSize</span><span class="p">((</span><span class="mi">720</span><span class="p">,</span> <span class="mi">650</span><span class="p">))</span>
+        <span class="c"># font size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+
+        <span class="c"># check if tit is MAC</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">is_pdf</span> <span class="o">=</span> <span class="n">ISPDF</span>
+        
+        <span class="c"># report string</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span> <span class="o">=</span> <span class="nb">list</span>
+        <span class="c"># put image path in the report string</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">report_html</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">%</span> <span class="s">&quot;memory:img_inv.png&quot;</span>
+        <span class="c"># layout</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_setup_layout</span><span class="p">()</span>
+        <span class="c"># wild card</span>
+        <span class="c"># pdf supporting only on MAC</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_pdf</span><span class="p">:</span>
+        	<span class="bp">self</span><span class="o">.</span><span class="n">wild_card</span> <span class="o">=</span> <span class="s">&#39; PDF files (*.pdf)|*.pdf|&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+        	<span class="bp">self</span><span class="o">.</span><span class="n">wild_card</span> <span class="o">=</span> <span class="s">&#39;&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wild_card</span> <span class="o">+=</span> <span class="s">&#39;HTML files (*.html)|*.html|&#39;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">wild_card</span> <span class="o">+=</span> <span class="s">&#39;Text files (*.txt)|*.txt&#39;</span>
+  
+        
+        
+    <span class="k">def</span> <span class="nf">_setup_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set up layout</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">hbox</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>
+        
+        <span class="c"># buttons</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span>
+        <span class="n">button_close</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Close&quot;</span><span class="p">)</span>
+        <span class="n">button_close</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Close this report window.&quot;</span><span class="p">)</span> 
+        <span class="c">#hbox.Add((5,10), 1 , wx.EXPAND|wx.ADJUST_MINSIZE,0)</span>
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_close</span><span class="p">)</span>
+        <span class="n">button_close</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">button_preview</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Preview&quot;</span><span class="p">)</span>
+        <span class="n">button_preview</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Print preview this report.&quot;</span><span class="p">)</span>
+        <span class="n">button_preview</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onPreview</span><span class="p">,</span>
+                            <span class="nb">id</span><span class="o">=</span><span class="n">button_preview</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span> 
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_preview</span><span class="p">)</span>
+
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">button_print</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Print&quot;</span><span class="p">)</span>
+        <span class="n">button_print</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Print this report.&quot;</span><span class="p">)</span>
+        <span class="n">button_print</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onPrint</span><span class="p">,</span>
+                          <span class="nb">id</span><span class="o">=</span><span class="n">button_print</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span> 
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_print</span><span class="p">)</span>
+        
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">button_save</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Save&quot;</span> <span class="p">)</span>
+        <span class="n">button_save</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Save this report.&quot;</span><span class="p">)</span>
+        <span class="n">button_save</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onSave</span><span class="p">,</span> <span class="nb">id</span> <span class="o">=</span> <span class="n">button_save</span><span class="o">.</span><span class="n">GetId</span><span class="p">())</span> 
+        <span class="n">hbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_save</span><span class="p">)</span>     
+        
+        <span class="c"># panel for report page</span>
+        <span class="c">#panel = wx.Panel(self, -1)</span>
+        <span class="n">vbox</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>
+        <span class="c"># html window</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hwindow</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlWindow</span><span class="p">(</span><span class="bp">self</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">BORDER</span><span class="p">)</span>
+        <span class="c"># set the html page with the report string</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">hwindow</span><span class="o">.</span><span class="n">SetPage</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">report_html</span><span class="p">)</span>
+        
+        <span class="c"># add panels to boxsizers</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">hbox</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">hwindow</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Show</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+		
+
+    <span class="k">def</span> <span class="nf">onSave</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+<div class="viewcode-block" id="ReportDialog.onSave"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.report_dialog.ReportDialog.onSave">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Save</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#todo: complete saving fig file and as a txt file</span>
+        <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="bp">self</span><span class="p">,</span> <span class="s">&quot;Choose a file&quot;</span><span class="p">,</span>
+                            <span class="n">wildcard</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">wild_card</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">SAVE</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">OVERWRITE_PROMPT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">CHANGE_DIR</span><span class="p">)</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">SetFilterIndex</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="c">#Set .html files to be default</span>
+
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">!=</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+            <span class="k">return</span>
+
+        <span class="n">fName</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+        <span class="n">ext_num</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetFilterIndex</span><span class="p">()</span>  
+        <span class="c"># index correction </span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_pdf</span><span class="p">:</span>
+        	<span class="n">ind_cor</span> <span class="o">=</span> <span class="mi">1</span> 
+        <span class="k">else</span><span class="p">:</span>
+        	<span class="n">ind_cor</span> <span class="o">=</span> <span class="mi">0</span> 
+        <span class="c">#set file extensions  </span>
+        <span class="k">if</span> <span class="n">ext_num</span> <span class="o">==</span> <span class="p">(</span><span class="mi">0</span> <span class="o">+</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">ind_cor</span><span class="p">):</span>
+			<span class="c"># TODO: Sort this case out</span>
+            <span class="n">ext</span> <span class="o">=</span> <span class="s">&#39;.pdf&#39;</span>
+            <span class="n">img_ext</span> <span class="o">=</span> <span class="s">&#39;_img.png&#39;</span>
+            <span class="n">fName</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">fName</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">ext</span>
+            <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+
+            <span class="c">#pic (png) file path/name</span>
+            <span class="n">pic_fname</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">fName</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">img_ext</span>
+            <span class="c"># save the image for use with pdf writer</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">savefig</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">)</span>
+
+            <span class="c"># put the image file path in the html data</span>
+            <span class="n">html</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">)</span>
+            
+            <span class="c"># make/open file in case of absence</span>
+            <span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">fName</span><span class="p">,</span> <span class="s">&#39;w&#39;</span><span class="p">)</span>
+            <span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+            <span class="c"># write pdf as a pdf file</span>
+            <span class="n">pdf</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">HTML2PDF</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">html</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="n">fName</span><span class="p">)</span>
+            
+            <span class="c">#open pdf</span>
+            <span class="k">if</span> <span class="n">pdf</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="c">#Windows</span>
+                    <span class="n">os</span><span class="o">.</span><span class="n">startfile</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">fName</span><span class="p">))</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">try</span><span class="p">:</span>
+                        <span class="c">#Mac</span>
+                        <span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span><span class="s">&quot;open </span><span class="si">%s</span><span class="s">&quot;</span><span class="o">%</span> <span class="n">fName</span><span class="p">)</span>
+                    <span class="k">except</span><span class="p">:</span>
+                        <span class="c">#DO not open</span>
+                        <span class="k">pass</span>
+            <span class="c">#delete image file</span>
+            <span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">)</span>
+            <span class="k">return</span>
+        <span class="k">elif</span> <span class="n">ext_num</span> <span class="o">==</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">ind_cor</span><span class="p">):</span>
+            <span class="n">ext</span> <span class="o">=</span> <span class="s">&#39;.html&#39;</span>
+            <span class="n">img_ext</span> <span class="o">=</span> <span class="s">&#39;_img4html.png&#39;</span>
+            <span class="n">report_frame</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="k">elif</span> <span class="n">ext_num</span> <span class="o">==</span> <span class="p">(</span><span class="mi">2</span> <span class="o">-</span> <span class="n">ind_cor</span><span class="p">):</span>
+            <span class="n">ext</span> <span class="o">=</span> <span class="s">&#39;.txt&#39;</span>   
+            <span class="c"># changing the image extension actually changes the image</span>
+            <span class="c"># format on saving</span>
+            <span class="n">img_ext</span> <span class="o">=</span> <span class="s">&#39;_img4txt.pdf&#39;</span>
+            <span class="n">report</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span>
+
+        <span class="c">#file name     </span>
+        <span class="n">fName</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">fName</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">ext</span>
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        <span class="c">#pic (png) file path/name</span>
+        <span class="n">pic_fname</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">fName</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">img_ext</span>
+        <span class="c">#put the image path in html string</span>
+        <span class="k">if</span> <span class="n">ext_num</span> <span class="o">==</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">ind_cor</span><span class="p">):</span>
+            <span class="n">report</span> <span class="o">=</span> <span class="n">report_frame</span> <span class="o">%</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">)</span>
+
+        <span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">fName</span><span class="p">,</span> <span class="s">&#39;w&#39;</span><span class="p">)</span>
+        <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">report</span><span class="p">)</span>
+        <span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+        <span class="c">#save png file using pic_fname</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">report_list</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">savefig</span><span class="p">(</span><span class="n">pic_fname</span><span class="p">)</span>
+        
+            
+    <span class="k">def</span> <span class="nf">onPreview</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ReportDialog.onPreview"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.report_dialog.ReportDialog.onPreview">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Preview</span>
+<span class="sd">        </span>
+<span class="sd">        : event: Preview button event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">previewh</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlEasyPrinting</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;Printing&quot;</span><span class="p">,</span> <span class="n">parentWindow</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">previewh</span><span class="o">.</span><span class="n">PreviewText</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">report_html</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+    
+    <span class="k">def</span> <span class="nf">onPrint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ReportDialog.onPrint"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.report_dialog.ReportDialog.onPrint">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Print</span>
+<span class="sd">        </span>
+<span class="sd">        : event: Print button event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">printh</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">HtmlEasyPrinting</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;Printing&quot;</span><span class="p">,</span> <span class="n">parentWindow</span><span class="o">=</span><span class="bp">self</span><span class="p">)</span>
+        <span class="n">printh</span><span class="o">.</span><span class="n">PrintText</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">report_html</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+
+    <span class="k">def</span> <span class="nf">OnClose</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ReportDialog.OnClose"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.report_dialog.ReportDialog.OnClose">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Close the Dialog</span>
+<span class="sd">        </span>
+<span class="sd">        : event: Close button event</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Close</span><span class="p">()</span>
+    
+    <span class="k">def</span> <span class="nf">HTML2PDF</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ReportDialog.HTML2PDF"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.invariant.html#sas.perspectives.invariant.report_dialog.ReportDialog.HTML2PDF">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create a PDF file from html source string. </span>
+<span class="sd">        </span>
+<span class="sd">        : data: html string</span>
+<span class="sd">        : filename: name of file to be saved</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">import</span> <span class="nn">ho.pisa</span> <span class="kn">as</span> <span class="nn">pisa</span>
+        <span class="n">f</span> <span class="o">=</span> <span class="nb">file</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s">&quot;wb&quot;</span><span class="p">)</span>
+        <span class="c"># pisa requires some extra packages, see their web-site</span>
+        <span class="n">pdf</span> <span class="o">=</span> <span class="n">pisa</span><span class="o">.</span><span class="n">CreatePDF</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span>
+        <span class="c"># close the file here otherwise it will be open until quitting</span>
+        <span class="c">#the application.</span>
+        <span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+
+        <span class="k">return</span> <span class="ow">not</span> <span class="n">pdf</span><span class="o">.</span><span class="n">err</span>
+
+        
+        
+</pre></div></div></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li>
+          <li><a href="../invariant.html" >sas.perspectives.invariant</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/pr/explore_dialog.html
===================================================================
--- _modules/sas/perspectives/pr/explore_dialog.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/pr/explore_dialog.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,567 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.pr.explore_dialog &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="Module code" href="../../../index.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" accesskey="U">Module code</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.pr.explore_dialog</h1><div class="highlight"><pre>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation. </span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Dialog panel to explore the P(r) inversion results for a range</span>
+<span class="sd">of D_max value. User picks a number of points and a range of</span>
+<span class="sd">distances, then can toggle between inversion outputs and see</span>
+<span class="sd">their distribution as a function of D_max.</span>
+<span class="sd">&quot;&quot;&quot;</span>
+    
+
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">numpy</span>
+<span class="kn">import</span> <span class="nn">math</span>
+<span class="kn">import</span> <span class="nn">logging</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+
+<span class="c"># Avoid Matplotlib complaining about the lack of legend on the plot </span>
+<span class="kn">import</span> <span class="nn">warnings</span>
+<span class="n">warnings</span><span class="o">.</span><span class="n">simplefilter</span><span class="p">(</span><span class="s">&quot;ignore&quot;</span><span class="p">)</span>
+
+<span class="c"># Import plotting classes</span>
+<span class="kn">from</span> <span class="nn">sas.plottools.PlotPanel</span> <span class="kn">import</span> <span class="n">PlotPanel</span>
+<span class="kn">from</span> <span class="nn">sas.plottools</span> <span class="kn">import</span> <span class="n">Data1D</span> <span class="k">as</span> <span class="n">Model1D</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.gui_style</span> <span class="kn">import</span> <span class="n">GUIFRAME_ID</span>
+<span class="kn">from</span> <span class="nn">sas.plottools.plottables</span> <span class="kn">import</span> <span class="n">Graph</span>
+
+<span class="kn">from</span> <span class="nn">pr_widgets</span> <span class="kn">import</span> <span class="n">PrTextCtrl</span>
+
+<span class="c"># Default number of points on the output plot</span>
+<span class="n">DEFAULT_NPTS</span> <span class="o">=</span> <span class="mi">10</span>
+<span class="c"># Default output parameter to plot</span>
+<span class="n">DEFAULT_OUTPUT</span> <span class="o">=</span> <span class="s">&#39;Chi2/dof&#39;</span>
+
+<span class="k">class</span> <span class="nc">OutputPlot</span><span class="p">(</span><span class="n">PlotPanel</span><span class="p">):</span>
+<div class="viewcode-block" id="OutputPlot"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.explore_dialog.OutputPlot">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Plot panel used to show the selected results as a function</span>
+<span class="sd">    of D_max</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">d_min</span><span class="p">,</span> <span class="n">d_max</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">color</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>\
+        <span class="n">dpi</span> <span class="o">=</span> <span class="bp">None</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">NO_FULL_REPAINT_ON_RESIZE</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialization. The parameters added to PlotPanel are:</span>
+<span class="sd">        </span>
+<span class="sd">        :param d_min: Minimum value of D_max to explore</span>
+<span class="sd">        :param d_max: Maximum value of D_max to explore</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">PlotPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span> <span class="o">=</span> <span class="nb">id</span><span class="p">,</span> <span class="n">style</span> <span class="o">=</span> <span class="n">style</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">min</span> <span class="o">=</span> <span class="n">d_min</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">max</span> <span class="o">=</span> <span class="n">d_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts</span> <span class="o">=</span> <span class="n">DEFAULT_NPTS</span>
+
+        <span class="n">step</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">max</span><span class="o">-</span><span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">max</span><span class="o">+</span><span class="n">step</span><span class="o">*</span><span class="mf">0.01</span><span class="p">,</span> <span class="n">step</span><span class="p">)</span>
+        <span class="n">dx</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x</span><span class="p">))</span>
+        <span class="n">y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x</span><span class="p">))</span>
+        <span class="n">dy</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x</span><span class="p">))</span>
+ 
+        <span class="c"># Plot area</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot</span> <span class="o">=</span> <span class="n">Model1D</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="n">y</span><span class="p">,</span> <span class="n">dy</span><span class="o">=</span><span class="n">dy</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">DEFAULT_OUTPUT</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+
+        <span class="c"># Graph        </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph</span> <span class="o">=</span> <span class="n">Graph</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{D_{max}}&quot;</span><span class="p">,</span> <span class="s">&#39;A&#39;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{</span><span class="si">%s</span><span class="s">}&quot;</span> <span class="o">%</span> <span class="n">DEFAULT_OUTPUT</span><span class="p">,</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">plot</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">toolbar</span><span class="o">.</span><span class="n">DeleteToolByPos</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">toolbar</span><span class="o">.</span><span class="n">DeleteToolByPos</span><span class="p">(</span><span class="mi">8</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">toolbar</span><span class="o">.</span><span class="n">Realize</span><span class="p">()</span>
+
+    <span class="k">def</span> <span class="nf">onContextMenu</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+<div class="viewcode-block" id="OutputPlot.onContextMenu"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.explore_dialog.OutputPlot.onContextMenu">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Default context menu for the plot panel</span>
+<span class="sd">        </span>
+<span class="sd">        :TODO: Would be nice to add printing and log/linear scales.</span>
+<span class="sd">            The current verison of plottools no longer plays well with </span>
+<span class="sd">            plots outside of guiframe. Guiframe team needs to fix this. </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Slicer plot popup menu</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">slicerpop</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Menu</span><span class="p">()</span>
+        <span class="n">slicerpop</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="s">&#39;&amp;Save image&#39;</span><span class="p">,</span> <span class="s">&#39;Save image as PNG&#39;</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onSaveImage</span><span class="p">)</span>
+        
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">slicerpop</span><span class="o">.</span><span class="n">AppendSeparator</span><span class="p">()</span>
+        <span class="n">slicerpop</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="s">&#39;&amp;Reset Graph&#39;</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="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">onResetGraph</span><span class="p">)</span>
+       
+        <span class="n">pos</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetPosition</span><span class="p">()</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">ScreenToClient</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">PopupMenu</span><span class="p">(</span><span class="n">slicerpop</span><span class="p">,</span> <span class="n">pos</span><span class="p">)</span>
+
+<span class="k">class</span> <span class="nc">Results</span><span class="p">:</span></div></div>
+<div class="viewcode-block" id="Results"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.explore_dialog.Results">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Class to hold the inversion output parameters</span>
+<span class="sd">    as a function of D_max</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialization. Create empty arrays</span>
+<span class="sd">        and dictionary of labels.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Array of output for each inversion</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">chi2</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">osc</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos_err</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rg</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">iq0</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bck</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">d_max</span> <span class="o">=</span> <span class="p">[]</span>
+        
+        <span class="c"># Dictionary of outputs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs</span><span class="p">[</span><span class="s">&#39;Chi2/dof&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;\chi^2/dof&quot;</span><span class="p">,</span> <span class="s">&quot;a.u.&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">chi2</span><span class="p">]</span>    
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs</span><span class="p">[</span><span class="s">&#39;Oscillation parameter&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;Osc&quot;</span><span class="p">,</span> <span class="s">&quot;a.u.&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">osc</span><span class="p">]</span>    
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs</span><span class="p">[</span><span class="s">&#39;Positive fraction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;P^+&quot;</span><span class="p">,</span> <span class="s">&quot;a.u.&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">pos</span><span class="p">]</span>    
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs</span><span class="p">[</span><span class="s">&#39;1-sigma positive fraction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;P^+_{1\ \sigma}&quot;</span><span class="p">,</span> 
+                                                     <span class="s">&quot;a.u.&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">pos_err</span><span class="p">]</span>    
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs</span><span class="p">[</span><span class="s">&#39;Rg&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;R_g&quot;</span><span class="p">,</span> <span class="s">&quot;A&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">rg</span><span class="p">]</span>    
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs</span><span class="p">[</span><span class="s">&#39;I(q=0)&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;I(q=0)&quot;</span><span class="p">,</span> <span class="s">&quot;1/A&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">iq0</span><span class="p">]</span>    
+        <span class="bp">self</span><span class="o">.</span><span class="n">outputs</span><span class="p">[</span><span class="s">&#39;Background&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;Bck&quot;</span><span class="p">,</span> <span class="s">&quot;1/A&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">bck</span><span class="p">]</span> 
+        
+<span class="k">class</span> <span class="nc">ExploreDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span></div>
+<div class="viewcode-block" id="ExploreDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.explore_dialog.ExploreDialog">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    The explorer dialog box. This dialog is meant to be</span>
+<span class="sd">    invoked by the InversionControl class.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pr_state</span><span class="p">,</span> <span class="n">nfunc</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialization. The parameters added to Dialog are:</span>
+<span class="sd">        </span>
+<span class="sd">        :param pr_state: sas.pr.invertor.Invertor object</span>
+<span class="sd">        :param nfunc: Number of terms in the expansion</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&quot;style&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RESIZE_BORDER</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">DEFAULT_DIALOG_STYLE</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        
+        <span class="c"># Initialize Results object</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">results</span> <span class="o">=</span> <span class="n">Results</span><span class="p">()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span>  <span class="o">=</span> <span class="n">pr_state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_min</span> <span class="o">=</span> <span class="mf">0.9</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">d_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_max</span> <span class="o">=</span> <span class="mf">1.1</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">d_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span>     <span class="o">=</span> <span class="n">nfunc</span>
+        
+        <span class="c"># Control for number of points</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span> <span class="o">=</span> <span class="n">PrTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                   <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+        <span class="c"># Control for the minimum value of D_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dmin_ctl</span> <span class="o">=</span> <span class="n">PrTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                   <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+        <span class="c"># Control for the maximum value of D_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span> <span class="o">=</span> <span class="n">PrTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                   <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+
+        <span class="c"># Output selection box for the y axis</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_box</span> <span class="o">=</span> <span class="bp">None</span>
+
+        <span class="c"># Create the plot object</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plotpanel</span> <span class="o">=</span> <span class="n">OutputPlot</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_default_min</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_default_max</span><span class="p">,</span>
+                                    <span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">RAISED_BORDER</span><span class="p">)</span>
+        
+        <span class="c"># Create the layout of the dialog</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">__do_layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Fit</span><span class="p">()</span>
+        
+        <span class="c"># Calculate exploration results</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_recalc</span><span class="p">()</span>
+        <span class="c"># Graph the default output curve</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_plot_output</span><span class="p">()</span>
+        
+    <span class="k">class</span> <span class="nc">Event</span><span class="p">:</span>
+<div class="viewcode-block" id="ExploreDialog.Event"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.explore_dialog.ExploreDialog.Event">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Class that holds the content of the form</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Number of points to be plotted</span>
+        <span class="n">npts</span>   <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">## Minimum value of D_max</span>
+        <span class="n">dmin</span>   <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">## Maximum value of D_max</span>
+        <span class="n">dmax</span>   <span class="o">=</span> <span class="mi">0</span>
+                
+    <span class="k">def</span> <span class="nf">_get_values</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Invoked when the user changes a value of the form.</span>
+<span class="sd">        Check that the values are of the right type.</span>
+<span class="sd">        </span>
+<span class="sd">        :return: ExploreDialog.Event object if the content is good, </span>
+<span class="sd">            None otherwise</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Flag to make sure that all values are good</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        
+        <span class="c"># Empty ExploreDialog.Event content</span>
+        <span class="n">content_event</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">Event</span><span class="p">()</span>
+        
+        <span class="c"># Read each text control and make sure the type is valid</span>
+        <span class="c"># Let the user know if a type is invalid by changing the</span>
+        <span class="c"># background color of the control.</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">content_event</span><span class="o">.</span><span class="n">npts</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">content_event</span><span class="o">.</span><span class="n">dmin</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dmin_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmin_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmin_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmin_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmin_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">content_event</span><span class="o">.</span><span class="n">dmax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        
+        <span class="c"># If the content of the form is valid, return the content,</span>
+        <span class="c"># otherwise return None</span>
+        <span class="k">if</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">event</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="k">return</span> <span class="n">content_event</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+    
+    <span class="k">def</span> <span class="nf">_plot_output</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Invoked when a new output type is selected for plotting, </span>
+<span class="sd">        or when a new computation is finished.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Get the output type selection</span>
+        <span class="n">output_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">output_box</span><span class="o">.</span><span class="n">GetString</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output_box</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">())</span>
+        
+        <span class="c"># If the selected output type is part of the results ojbect,</span>
+        <span class="c"># display the results. </span>
+        <span class="c"># Note: by design, the output type should always be part of the</span>
+        <span class="c">#       results object.</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">results</span><span class="o">.</span><span class="n">outputs</span><span class="o">.</span><span class="n">has_key</span><span class="p">(</span><span class="n">output_type</span><span class="p">):</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">plotpanel</span><span class="o">.</span><span class="n">plot</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">results</span><span class="o">.</span><span class="n">d_max</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">plotpanel</span><span class="o">.</span><span class="n">plot</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">results</span><span class="o">.</span><span class="n">outputs</span><span class="p">[</span><span class="n">output_type</span><span class="p">][</span><span class="mi">2</span><span class="p">]</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">plotpanel</span><span class="o">.</span><span class="n">plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">&#39;_nolegend_&#39;</span>
+            <span class="n">y_label</span> <span class="o">=</span> <span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{</span><span class="si">%s</span><span class="s">}&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">results</span><span class="o">.</span><span class="n">outputs</span><span class="p">[</span><span class="n">output_type</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">plotpanel</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="n">y_label</span><span class="p">,</span>
+                                       <span class="bp">self</span><span class="o">.</span><span class="n">results</span><span class="o">.</span><span class="n">outputs</span><span class="p">[</span><span class="n">output_type</span><span class="p">][</span><span class="mi">1</span><span class="p">])</span>
+            
+            <span class="c"># Redraw</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">plotpanel</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">plotpanel</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">plotpanel</span><span class="o">.</span><span class="n">subplot</span><span class="o">.</span><span class="n">figure</span><span class="o">.</span><span class="n">canvas</span><span class="o">.</span><span class="n">draw_idle</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span>  <span class="s">&quot;ExploreDialog: the Results object&#39;s dictionary &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;does not contain &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;the [</span><span class="si">%s</span><span class="s">] output type. This must be indicative of &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;a change in the &quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">output_type</span><span class="p">)</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;ExploreDialog code.&quot;</span>
+            <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">__do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Do the layout of the dialog</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Dialog box properties</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="s">&quot;D_max Explorer&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSize</span><span class="p">((</span><span class="mi">600</span><span class="p">,</span> <span class="mi">595</span><span class="p">))</span>
+        
+        <span class="n">sizer_main</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>
+        <span class="n">sizer_button</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>
+        <span class="n">sizer_params</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">label_npts</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Npts&quot;</span><span class="p">)</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_npts</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> 
+                         <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="p">,</span>   <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> 
+                         <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">DEFAULT_NPTS</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</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="bp">self</span><span class="o">.</span><span class="n">_recalc</span><span class="p">)</span>
+        
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">label_dmin</span>   <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Min Distance [A]&quot;</span><span class="p">)</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_dmin</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                         <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dmin_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                         <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dmin_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_default_min</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dmin_ctl</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="bp">self</span><span class="o">.</span><span class="n">_recalc</span><span class="p">)</span>
+        
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">label_dmax</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Max Distance [A]&quot;</span><span class="p">)</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_dmax</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                         <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">ix</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="p">,</span>   <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                         <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_default_max</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</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="bp">self</span><span class="o">.</span><span class="n">_recalc</span><span class="p">)</span>
+
+
+        <span class="c"># Ouput selection box</span>
+        <span class="n">selection_msg</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Select a dependent variable:&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_box</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">results</span><span class="o">.</span><span class="n">outputs</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">output_box</span><span class="o">.</span><span class="n">Append</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">output_box</span><span class="o">.</span><span class="n">SetStringSelection</span><span class="p">(</span><span class="n">DEFAULT_OUTPUT</span><span class="p">)</span>
+        
+        <span class="n">output_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">output_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">selection_msg</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                         <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">output_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output_box</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span>
+                         <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+        <span class="n">wx</span><span class="o">.</span><span class="n">EVT_COMBOBOX</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output_box</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_plot_output</span><span class="p">)</span> 
+        <span class="n">sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">output_sizer</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+        <span class="n">sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">plotpanel</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">EXPAND</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">sizer_main</span><span class="o">.</span><span class="n">SetItemMinSize</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">plotpanel</span><span class="p">,</span> <span class="mi">400</span><span class="p">,</span> <span class="mi">400</span><span class="p">)</span>
+        
+        <span class="n">sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_params</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">static_line_3</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">static_line_3</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">EXPAND</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        
+        <span class="c"># Bottom area with the close button</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">button_OK</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">,</span> <span class="s">&quot;Close&quot;</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_OK</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+        <span class="n">sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_button</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">sizer_main</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+        
+        <span class="c"># Bind the Enter key to recalculation</span>
+        <span class="bp">self</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="bp">self</span><span class="o">.</span><span class="n">_recalc</span><span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">set_plot_unfocus</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="ExploreDialog.set_plot_unfocus"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.explore_dialog.ExploreDialog.set_plot_unfocus">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Not implemented</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">pass</span>
+    
+    <span class="k">def</span> <span class="nf">_recalc</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Invoked when the user changed a value on the form.</span>
+<span class="sd">        Process the form and compute the output to be plottted.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Get the content of the form</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_values</span><span class="p">()</span>
+        <span class="c"># If the content of the form is invalid, return and do nothing</span>
+        <span class="k">if</span> <span class="n">content</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">return</span>
+        
+        <span class="c"># Results object to store the computation outputs.</span>
+        <span class="n">results</span> <span class="o">=</span> <span class="n">Results</span><span class="p">()</span>
+        
+        <span class="c"># Loop over d_max values</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">content</span><span class="o">.</span><span class="n">npts</span><span class="p">):</span> 
+            <span class="n">temp</span> <span class="o">=</span> <span class="p">(</span><span class="n">content</span><span class="o">.</span><span class="n">dmax</span> <span class="o">-</span> <span class="n">content</span><span class="o">.</span><span class="n">dmin</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="n">content</span><span class="o">.</span><span class="n">npts</span> <span class="o">-</span> <span class="mf">1.0</span><span class="p">)</span>   
+            <span class="n">d</span> <span class="o">=</span> <span class="n">content</span><span class="o">.</span><span class="n">dmin</span> <span class="o">+</span> <span class="n">i</span> <span class="o">*</span> <span class="n">temp</span>
+                
+            <span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">d_max</span> <span class="o">=</span> <span class="n">d</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">out</span><span class="p">,</span> <span class="n">cov</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">invert</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">)</span>   
+            
+                <span class="c"># Store results</span>
+                <span class="n">iq0</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">iq0</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
+                <span class="n">rg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">rg</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
+                <span class="n">pos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">get_positive</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
+                <span class="n">pos_err</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">get_pos_err</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">cov</span><span class="p">)</span>
+                <span class="n">osc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">oscillations</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
+            
+                <span class="n">results</span><span class="o">.</span><span class="n">d_max</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">d_max</span><span class="p">)</span>
+                <span class="n">results</span><span class="o">.</span><span class="n">bck</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">background</span><span class="p">)</span>
+                <span class="n">results</span><span class="o">.</span><span class="n">chi2</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pr_state</span><span class="o">.</span><span class="n">chi2</span><span class="p">)</span>
+                <span class="n">results</span><span class="o">.</span><span class="n">iq0</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">iq0</span><span class="p">)</span>
+                <span class="n">results</span><span class="o">.</span><span class="n">rg</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">rg</span><span class="p">)</span>
+                <span class="n">results</span><span class="o">.</span><span class="n">pos</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">pos</span><span class="p">)</span>
+                <span class="n">results</span><span class="o">.</span><span class="n">pos_err</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">pos_err</span><span class="p">)</span>
+                <span class="n">results</span><span class="o">.</span><span class="n">osc</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">osc</span><span class="p">)</span>           
+            <span class="k">except</span><span class="p">:</span>
+                <span class="c"># This inversion failed, skip this D_max value</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;ExploreDialog: inversion failed &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;for D_max=</span><span class="si">%s</span><span class="se">\n</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">d</span><span class="p">),</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+                <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">results</span> <span class="o">=</span> <span class="n">results</span>            
+         
+        <span class="c"># Plot the selected output</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_plot_output</span><span class="p">()</span>   
+            
+<span class="c">##### testing code ############################################################</span>
+<span class="sd">&quot;&quot;&quot;</span></div>
+<span class="sd">Example: ::</span>
+
+<span class="sd">class MyApp(wx.App):</span>
+<span class="sd">    </span>
+<span class="sd">    #Test application used to invoke the ExploreDialog for testing</span>
+<span class="sd">   </span>
+<span class="sd">    def OnInit(self):</span>
+<span class="sd">        from inversion_state import Reader</span>
+<span class="sd">        from sas.pr.invertor import Invertor</span>
+<span class="sd">        wx.InitAllImageHandlers()</span>
+<span class="sd">        </span>
+<span class="sd">        def call_back(state, datainfo=None):</span>
+<span class="sd">            </span>
+<span class="sd">            #Dummy call-back method used by the P(r) </span>
+<span class="sd">            #file reader.</span>
+<span class="sd">            </span>
+<span class="sd">            print state</span>
+<span class="sd">            </span>
+<span class="sd">        # Load test data</span>
+<span class="sd">        # This would normally be loaded by the application </span>
+<span class="sd">        # of the P(r) plug-in.</span>
+<span class="sd">        r = Reader(call_back)</span>
+<span class="sd">        data = r.read(&quot;test_pr_data.prv&quot;)</span>
+<span class="sd">        pr_state = data.meta_data[&#39;prstate&#39;]</span>
+<span class="sd">        </span>
+<span class="sd">        # Create Invertor object for the data</span>
+<span class="sd">        # This would normally be assembled by the P(r) plug-in</span>
+<span class="sd">        pr = Invertor()</span>
+<span class="sd">        pr.d_max = pr_state.d_max</span>
+<span class="sd">        pr.alpha = pr_state.alpha</span>
+<span class="sd">        pr.q_min = pr_state.qmin</span>
+<span class="sd">        pr.q_max = pr_state.qmax</span>
+<span class="sd">        pr.x = data.x</span>
+<span class="sd">        pr.y = data.y</span>
+<span class="sd">        pr.err = data.y*0.1</span>
+<span class="sd">        pr.has_bck = False</span>
+<span class="sd">        pr.slit_height = pr_state.height</span>
+<span class="sd">        pr.slit_width = pr_state.width</span>
+<span class="sd">        </span>
+<span class="sd">        # Create the dialog</span>
+<span class="sd">        dialog = ExploreDialog(pr, 10, None, -1, &quot;&quot;)</span>
+<span class="sd">        self.SetTopWindow(dialog)</span>
+<span class="sd">        dialog.ShowModal()</span>
+<span class="sd">        dialog.Destroy()</span>
+
+<span class="sd">        return 1</span>
+
+<span class="sd">if __name__ == &quot;__main__&quot;:</span>
+<span class="sd">    app = MyApp(0)</span>
+<span class="sd">    app.MainLoop()</span>
+<span class="sd">    </span>
+<span class="sd">&quot;&quot;&quot;</span> 
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/pr/inversion_panel.html
===================================================================
--- _modules/sas/perspectives/pr/inversion_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/pr/inversion_panel.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,1194 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.pr.inversion_panel &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="Module code" href="../../../index.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" accesskey="U">Module code</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.pr.inversion_panel</h1><div class="highlight"><pre>
+<span class="c">#!/usr/bin/env python</span>
+
+<span class="c"># version</span>
+<span class="n">__id__</span> <span class="o">=</span> <span class="s">&quot;$Id: aboutdialog.py 1193 2007-05-03 17:29:59Z dmitriy $&quot;</span>
+<span class="n">__revision__</span> <span class="o">=</span> <span class="s">&quot;$Revision: 1193 $&quot;</span>
+
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">logging</span>
+<span class="kn">from</span> <span class="nn">wx.lib.scrolledpanel</span> <span class="kn">import</span> <span class="n">ScrolledPanel</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span>   
+<span class="kn">from</span> <span class="nn">sas.guiframe.panel_base</span> <span class="kn">import</span> <span class="n">PanelBase</span> 
+<span class="kn">from</span> <span class="nn">inversion_state</span> <span class="kn">import</span> <span class="n">InversionState</span>
+<span class="kn">from</span> <span class="nn">pr_widgets</span> <span class="kn">import</span> <span class="n">PrTextCtrl</span>
+<span class="kn">from</span> <span class="nn">pr_widgets</span> <span class="kn">import</span> <span class="n">DataFileTextCtrl</span>
+<span class="kn">from</span> <span class="nn">pr_widgets</span> <span class="kn">import</span> <span class="n">OutputTextCtrl</span>
+
+<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&quot;win32&quot;</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">0</span>
+<span class="k">else</span><span class="p">:</span>
+    <span class="n">FONT_VARIANT</span> <span class="o">=</span> <span class="mi">1</span>
+
+<div class="viewcode-block" id="InversionControl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.InversionControl">[docs]</a><span class="k">class</span> <span class="nc">InversionControl</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">,</span> <span class="n">PanelBase</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">window_name</span> <span class="o">=</span> <span class="s">&#39;pr_control&#39;</span>
+    <span class="n">window_caption</span> <span class="o">=</span> <span class="s">&quot;P(r) control panel&quot;</span>
+    <span class="n">CENTER_PANE</span> <span class="o">=</span> <span class="bp">True</span>
+    
+    <span class="c"># Figure of merit parameters [default]</span>
+    
+    <span class="c">## Oscillation parameters (sin function = 1.1)</span>
+    <span class="n">oscillation_max</span> <span class="o">=</span> <span class="mf">1.5</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">plots</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                 <span class="n">standalone</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="nb">id</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
+        <span class="n">PanelBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        <span class="c">#Set window&#39;s font size </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">plots</span> <span class="o">=</span> <span class="n">plots</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">radio_buttons</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span><span class="o">.</span><span class="n">parent</span>
+        
+        <span class="c">## Data file TextCtrl</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_file</span>  <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span>  <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span>  <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span>  <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">time_ctl</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">chi2_ctl</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">osc_ctl</span>    <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">file_radio</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot_radio</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">label_sugg</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">swidth_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">sheight_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">rg_ctl</span>     <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">iq0_ctl</span>    <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bck_chk</span>    <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bck_ctl</span>    <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="c"># TextCtrl for fraction of positive P(r)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="c"># TextCtrl for fraction of 1 sigma positive P(r)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos_err_ctl</span> <span class="o">=</span> <span class="bp">None</span> 
+        
+        <span class="c">## Estimates</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## D_max distance explorator</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_explorator_ctl</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## Data manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## Standalone flage</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">standalone</span> <span class="o">=</span> <span class="n">standalone</span>
+        <span class="c">## Default file location for save</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span>\
+                        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_default_save_location</span>
+        
+        <span class="c"># Default width</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_width</span> <span class="o">=</span> <span class="mi">350</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_do_layout</span><span class="p">()</span>
+        
+    <span class="k">def</span> <span class="nf">__setattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Allow direct hooks to text boxes</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;nfunc&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;d_max&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">value</span><span class="p">))</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;alpha&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">value</span><span class="p">))</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;chi2&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">chi2_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;bck&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bck_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;q_min&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;q_max&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;elapsed&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">time_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span><span class="s">&#39;rg&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">rg_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;iq0&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">iq0_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;oscillation&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">osc_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;slit_width&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">swidth_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;slit_height&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sheight_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;positive&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">pos_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;pos_err&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">pos_err_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-5.2g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;alpha_estimate&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Click to accept value.&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-3.1g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+            <span class="c">#self.alpha_estimate_ctl.Show()</span>
+            <span class="c">#self.label_sugg.Show()</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;nterms_estimate&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Click to accept value.&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%-g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;plotname&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">value</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_on_pars_changed</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;datafile&#39;</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">value</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_on_pars_changed</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">Panel</span><span class="o">.</span><span class="n">__setattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">__getattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Allow direct hooks to text boxes</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;nfunc&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="o">-</span><span class="mi">1</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;d_max&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="o">-</span><span class="mf">1.0</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;alpha&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="o">-</span><span class="mf">1.0</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;chi2&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">chi2_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;bck&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bck_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;q_min&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="mf">0.0</span>
+        <span class="k">elif</span> <span class="n">name</span><span class="o">==</span><span class="s">&#39;q_max&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="mf">0.0</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;elapsed&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">time_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;rg&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">rg_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span><span class="o">==</span><span class="s">&#39;iq0&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">iq0_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;oscillation&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">osc_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;slit_width&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">swidth_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span><span class="o">==</span><span class="s">&#39;slit_height&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sheight_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;pos&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pos_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;pos_err&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pos_err_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;alpha_estimate&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;nterms_estimate&#39;</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">return</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">())</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;plotname&#39;</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">elif</span> <span class="n">name</span> <span class="o">==</span> <span class="s">&#39;datafile&#39;</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">wx</span><span class="o">.</span><span class="n">Panel</span><span class="o">.</span><span class="n">__getattribute__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
+        
+<div class="viewcode-block" id="InversionControl.save_project"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.InversionControl.save_project">[docs]</a>    <span class="k">def</span> <span class="nf">save_project</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">doc</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return an xml node containing state of the panel</span>
+<span class="sd">         that guiframe can write to file</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">data</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_state</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">new_doc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">state_reader</span><span class="o">.</span><span class="n">write_toXML</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">state</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">new_doc</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">doc</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">doc</span><span class="p">,</span> <span class="s">&quot;firstChild&quot;</span><span class="p">):</span>
+                    <span class="n">child</span> <span class="o">=</span> <span class="n">new_doc</span><span class="o">.</span><span class="n">getElementsByTagName</span><span class="p">(</span><span class="s">&quot;SASentry&quot;</span><span class="p">)</span>
+                    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">child</span><span class="p">:</span>
+                        <span class="n">doc</span><span class="o">.</span><span class="n">firstChild</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">doc</span> <span class="o">=</span> <span class="n">new_doc</span>
+        <span class="k">return</span> <span class="n">doc</span>   
+    </div>
+<div class="viewcode-block" id="InversionControl.on_save"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.InversionControl.on_save">[docs]</a>    <span class="k">def</span> <span class="nf">on_save</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Method used to create a memento of the current state</span>
+<span class="sd">            </span>
+<span class="sd">        :return: state object </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Ask the user the location of the file to write to.</span>
+        <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span>\
+             <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_default_save_location</span>
+        <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="bp">self</span><span class="p">,</span> <span class="s">&quot;Choose a file&quot;</span><span class="p">,</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span><span class="p">,</span>\
+                            <span class="bp">self</span><span class="o">.</span><span class="n">window_caption</span><span class="p">,</span> <span class="s">&quot;*.prv&quot;</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">SAVE</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">GetPath</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">_default_save_location</span> <span class="o">=</span>\
+                <span class="bp">self</span><span class="o">.</span><span class="n">_default_save_location</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        
+        <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        
+        <span class="n">state</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_state</span><span class="p">()</span>
+        
+        <span class="c"># MAC always needs the extension for saving</span>
+        <span class="n">extens</span> <span class="o">=</span> <span class="s">&quot;.prv&quot;</span>
+        <span class="c"># Make sure the ext included in the file name</span>
+        <span class="n">fName</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">path</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="n">extens</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">save_data</span><span class="p">(</span><span class="n">filepath</span><span class="o">=</span><span class="n">fName</span><span class="p">,</span> <span class="n">prstate</span><span class="o">=</span><span class="n">state</span><span class="p">)</span>
+        
+        <span class="k">return</span> <span class="n">state</span>
+    </div>
+<div class="viewcode-block" id="InversionControl.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.InversionControl.get_data">[docs]</a>    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+    </div>
+<div class="viewcode-block" id="InversionControl.get_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.InversionControl.get_state">[docs]</a>    <span class="k">def</span> <span class="nf">get_state</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the current state</span>
+<span class="sd">        </span>
+<span class="sd">        : return: state object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Construct the state object    </span>
+        <span class="n">state</span> <span class="o">=</span> <span class="n">InversionState</span><span class="p">()</span>
+        
+        <span class="c"># Read the panel&#39;s parameters</span>
+        <span class="n">flag</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="n">dmax</span><span class="p">,</span> <span class="n">nfunc</span><span class="p">,</span> <span class="n">qmin</span><span class="p">,</span> \
+        <span class="n">qmax</span><span class="p">,</span> <span class="n">height</span><span class="p">,</span> <span class="n">width</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_read_pars</span><span class="p">()</span>
+        
+        <span class="n">state</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="n">nfunc</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">d_max</span> <span class="o">=</span> <span class="n">dmax</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="n">alpha</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">qmin</span>  <span class="o">=</span> <span class="n">qmin</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">qmax</span>  <span class="o">=</span> <span class="n">qmax</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">width</span> <span class="o">=</span> <span class="n">width</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">height</span> <span class="o">=</span> <span class="n">height</span>
+        
+        <span class="c"># Data file</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+        
+        <span class="c"># Background evaluation checkbox</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">estimate_bck</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">bck_chk</span><span class="o">.</span><span class="n">IsChecked</span><span class="p">()</span>
+        
+        <span class="c"># Estimates</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">nterms_estimate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">alpha_estimate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate</span>
+        
+        <span class="c"># Read the output values</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">chi2</span>    <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">chi2</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">elapsed</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">elapsed</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">osc</span>     <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">oscillation</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">pos</span>     <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pos</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">pos_err</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pos_err</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">rg</span>      <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">rg</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">iq0</span>     <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">iq0</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">bck</span>     <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">bck</span>
+        
+        <span class="k">return</span> <span class="n">state</span>
+    </div>
+<div class="viewcode-block" id="InversionControl.set_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.InversionControl.set_state">[docs]</a>    <span class="k">def</span> <span class="nf">set_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Set the state of the panel and inversion problem to</span>
+<span class="sd">        the state passed as a parameter.</span>
+<span class="sd">        Execute the inversion immediately after filling the </span>
+<span class="sd">        controls.</span>
+<span class="sd">        </span>
+<span class="sd">        :param state: InversionState object</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">nfunc</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">nfunc</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">d_max</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">d_max</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">d_max</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">alpha</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">alpha</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">qmin</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">q_min</span>  <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">qmin</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">qmax</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">q_max</span>  <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">qmax</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">width</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">slit_width</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">width</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">height</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">slit_height</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">height</span>
+        
+        <span class="c"># Data file</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">file</span><span class="p">))</span>
+    
+        <span class="c"># Background evaluation checkbox</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bck_chk</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">state</span><span class="o">.</span><span class="n">estimate_bck</span><span class="p">)</span>
+        
+        <span class="c"># Estimates</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">nterms_estimate</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">nterms_estimate</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">alpha_estimate</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span> 
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">alpha_estimate</span> 
+    
+        
+        <span class="c"># Read the output values</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">chi2</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">chi2</span>    <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">chi2</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">elapsed</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">elapsed</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">elapsed</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">osc</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">oscillation</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">osc</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">pos</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">positive</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">pos</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">pos_err</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">pos_err</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">pos_err</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">rg</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">rg</span>      <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">rg</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">iq0</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">iq0</span>     <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">iq0</span>
+        <span class="k">if</span> <span class="n">state</span><span class="o">.</span><span class="n">bck</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">bck</span>     <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">bck</span>
+
+        <span class="c"># Perform inversion</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_invert</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>    
+        </div>
+<div class="viewcode-block" id="InversionControl.set_manager"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.InversionControl.set_manager">[docs]</a>    <span class="k">def</span> <span class="nf">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">manager</span><span class="p">):</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="o">=</span> <span class="n">manager</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="n">vbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span>
+        <span class="n">iy_vb</span> <span class="o">=</span> <span class="mi">0</span>
+
+        <span class="c"># ----- I(q) data -----</span>
+        <span class="n">databox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;I(q) data source&quot;</span><span class="p">)</span>
+        
+        <span class="n">boxsizer1</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">databox</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">_default_width</span><span class="p">,</span> <span class="mi">50</span><span class="p">))</span>
+        <span class="n">pars_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">file_radio</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Name:&quot;</span><span class="p">)</span>
+        <span class="n">pars_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">file_radio</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                       <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span> <span class="o">=</span> <span class="n">DataFileTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">260</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+        
+        <span class="n">pars_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                       <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">bck_chk</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Estimate background level&quot;</span><span class="p">)</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Check box to let the fit estimate &quot;</span>
+        <span class="n">hint_msg</span> <span class="o">+=</span> <span class="s">&quot;the constant background level.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bck_chk</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bck_chk</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="bp">self</span><span class="o">.</span><span class="n">_on_pars_changed</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">pars_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bck_chk</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span>
+                       <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">boxsizer1</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">pars_sizer</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">EXPAND</span><span class="p">)</span>  
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer1</span><span class="p">,</span> <span class="p">(</span><span class="n">iy_vb</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                 <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        
+        <span class="c"># ----- Add slit parameters -----</span>
+        <span class="k">if</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="n">sbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Slit parameters&quot;</span><span class="p">)</span>
+            <span class="n">sboxsizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">sbox</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+            <span class="n">sboxsizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">_default_width</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+            
+            <span class="n">sizer_slit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+    
+            <span class="n">label_sheight</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Height&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+            <span class="n">label_swidth</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Width&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+            <span class="c">#label_sunits1 = wx.StaticText(self, -1, &quot;[A^(-1)]&quot;)</span>
+            <span class="n">label_sunits2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;[A^(-1)]&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">55</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sheight_ctl</span> <span class="o">=</span> <span class="n">PrTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                          <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">swidth_ctl</span> <span class="o">=</span> <span class="n">PrTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                         <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+            <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Enter slit height in units of Q or leave blank.&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sheight_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+            <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Enter slit width in units of Q or leave blank.&quot;</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">swidth_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+            <span class="c">#self.sheight_ctl.Bind(wx.EVT_TEXT, self._on_pars_changed)</span>
+            <span class="c">#self.swidth_ctl.Bind(wx.EVT_TEXT,  self._on_pars_changed)</span>
+            
+            <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="n">sizer_slit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_sheight</span><span class="p">,</span>    <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                           <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+            <span class="n">sizer_slit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sheight_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                           <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+    
+            <span class="n">sizer_slit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_swidth</span><span class="p">,</span>     <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                           <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+            <span class="n">sizer_slit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">swidth_ctl</span><span class="p">,</span>  <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                           <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+            <span class="n">sizer_slit</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_sunits2</span><span class="p">,</span>    <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">4</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                           <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+            
+            <span class="n">sboxsizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_slit</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+            <span class="n">iy_vb</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sboxsizer</span><span class="p">,</span> <span class="p">(</span><span class="n">iy_vb</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                     <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        
+        
+        <span class="c"># ----- Q range -----</span>
+        <span class="n">qbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Q range&quot;</span><span class="p">)</span>
+        <span class="n">qboxsizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">qbox</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">qboxsizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">_default_width</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        
+        <span class="n">sizer_q</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+
+        <span class="n">label_qmin</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Q min&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="n">label_qmax</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Q max&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="c">#label_qunits1 = wx.StaticText(self, -1, &quot;[A^(-1)]&quot;)</span>
+        <span class="n">label_qunits2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;[A^(-1)]&quot;</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">55</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span> <span class="o">=</span> <span class="n">PrTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                   <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span> <span class="o">=</span> <span class="n">PrTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                   <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Select a lower bound for Q or leave blank.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Select an upper bound for Q or leave blank.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_pars_changed</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_pars_changed</span><span class="p">)</span>
+        
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_q</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_qmin</span><span class="p">,</span>    <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">sizer_q</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="c">#sizer_q.Add(label_qunits1, (iy,2), (1,1), wx.LEFT|wx.EXPAND, 15)</span>
+        <span class="n">sizer_q</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_qmax</span><span class="p">,</span>    <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">sizer_q</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">sizer_q</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_qunits2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">4</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">qboxsizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_q</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+
+        <span class="n">iy_vb</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">qboxsizer</span><span class="p">,</span> <span class="p">(</span><span class="n">iy_vb</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span>
+                 <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+    
+        <span class="c"># ----- Parameters -----</span>
+        <span class="n">parsbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Parameters&quot;</span><span class="p">)</span>
+        <span class="n">boxsizer2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">parsbox</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">boxsizer2</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">_default_width</span><span class="p">,</span><span class="mi">50</span><span class="p">))</span>
+        
+        <span class="n">explanation</span>  <span class="o">=</span> <span class="s">&quot;P(r) is found by fitting a set of base functions&quot;</span>
+        <span class="n">explanation</span> <span class="o">+=</span> <span class="s">&quot; to I(Q). The minimization involves&quot;</span>
+        <span class="n">explanation</span> <span class="o">+=</span> <span class="s">&quot; a regularization term to ensure a smooth P(r).&quot;</span>
+        <span class="n">explanation</span> <span class="o">+=</span> <span class="s">&quot; The regularization constant gives the size of that &quot;</span>  
+        <span class="n">explanation</span> <span class="o">+=</span> <span class="s">&quot;term. The suggested value is the value above which the&quot;</span>
+        <span class="n">explanation</span> <span class="o">+=</span> <span class="s">&quot; output P(r) will have only one peak.&quot;</span>
+        <span class="n">label_explain</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">explanation</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">280</span><span class="p">,</span><span class="mi">90</span><span class="p">))</span>
+        <span class="n">boxsizer2</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_explain</span><span class="p">,</span>  <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        
+        
+        
+        <span class="n">label_nfunc</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Number of terms&quot;</span><span class="p">)</span>
+        <span class="n">label_nfunc</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="mi">120</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="n">label_alpha</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Regularization constant&quot;</span><span class="p">)</span>
+        <span class="n">label_dmax</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Max distance [A]&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">label_sugg</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Suggested value&quot;</span><span class="p">)</span>
+        <span class="c">#self.label_sugg.Hide()</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span> <span class="o">=</span> <span class="n">PrTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Number of terms in the expansion.&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span> <span class="o">=</span> <span class="n">PrTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Control parameter for the size of the regularization term.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span>  <span class="o">=</span> <span class="n">PrTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="n">wx</span><span class="o">.</span><span class="n">TE_PROCESS_ENTER</span><span class="p">,</span>
+                                    <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Maximum distance between any two points in the system.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="c">#self.alpha_estimate_ctl.Hide()</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_accept_alpha</span><span class="p">,</span> <span class="nb">id</span> <span class="o">=</span> <span class="nb">id</span><span class="p">)</span>   
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="c">#self.alpha_estimate_ctl.SetBackgroundColour(&#39;#ffdf85&#39;)</span>
+        <span class="c">#self.alpha_estimate_ctl.SetBackgroundColour(self.GetBackgroundColour())</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Waiting for estimate...&quot;</span><span class="p">)</span>
+        
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="c">#self.nterms_estimate_ctl.Hide()</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_accept_nterms</span><span class="p">,</span> <span class="nb">id</span> <span class="o">=</span> <span class="nb">id</span><span class="p">)</span>   
+        <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+      
+        <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Waiting for estimate...&quot;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_read_pars</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_read_pars</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</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</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_pars_changed</span><span class="p">)</span>
+        
+        <span class="c"># Distance explorator</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">distance_explorator_ctl</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Explore&quot;</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_explore</span><span class="p">,</span> <span class="nb">id</span> <span class="o">=</span> <span class="nb">id</span><span class="p">)</span>           
+        
+        
+        <span class="n">sizer_params</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span>
+
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">label_sugg</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_nfunc</span><span class="p">,</span>      <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span><span class="p">,</span>   <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_alpha</span><span class="p">,</span>      <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span><span class="p">,</span>   <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_dmax</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="p">,</span>   <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_params</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">distance_explorator_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span>
+                         <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+
+        <span class="n">boxsizer2</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_params</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        
+        <span class="n">iy_vb</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">boxsizer2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy_vb</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                 <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+
+
+        <span class="c"># ----- Results -----</span>
+        <span class="n">resbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBox</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Outputs&quot;</span><span class="p">)</span>
+        <span class="n">ressizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticBoxSizer</span><span class="p">(</span><span class="n">resbox</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">VERTICAL</span><span class="p">)</span>
+        <span class="n">ressizer</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">_default_width</span><span class="p">,</span> <span class="mi">50</span><span class="p">))</span>
+        
+        <span class="n">label_rg</span>       <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Rg&quot;</span><span class="p">)</span>
+        <span class="n">label_rg_unit</span>  <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;[A]&quot;</span><span class="p">)</span>
+        <span class="n">label_iq0</span>      <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;I(Q=0)&quot;</span><span class="p">)</span>
+        <span class="n">label_iq0_unit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;[A^(-1)]&quot;</span><span class="p">)</span>
+        <span class="n">label_bck</span>      <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Background&quot;</span><span class="p">)</span>
+        <span class="n">label_bck_unit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;[A^(-1)]&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rg_ctl</span>    <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Radius of gyration for the computed P(r).&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rg_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">iq0_ctl</span>   <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Scattering intensity at Q=0 for the computed P(r).&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">iq0_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bck_ctl</span>   <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bck_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Value of estimated constant background.&quot;</span><span class="p">)</span>
+        
+        <span class="n">label_time</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Computation time&quot;</span><span class="p">)</span>
+        <span class="n">label_time_unit</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;secs&quot;</span><span class="p">)</span>
+        <span class="n">label_time</span><span class="o">.</span><span class="n">SetMinSize</span><span class="p">((</span><span class="mi">120</span><span class="p">,</span><span class="mi">20</span><span class="p">))</span>
+        <span class="n">label_chi2</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Chi2/dof&quot;</span><span class="p">)</span>
+        <span class="n">label_osc</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Oscillations&quot;</span><span class="p">)</span>
+        <span class="n">label_pos</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Positive fraction&quot;</span><span class="p">)</span>
+        <span class="n">label_pos_err</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;1-sigma positive fraction&quot;</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">time_ctl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Computation time for the last inversion, in seconds.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">time_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">chi2_ctl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">chi2_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Chi^2 over degrees of freedom.&quot;</span><span class="p">)</span>
+        
+        <span class="c"># Oscillation parameter</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">osc_ctl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Oscillation parameter. P(r) for a sphere has an &quot;</span>
+        <span class="n">hint_msg</span> <span class="o">+=</span> <span class="s">&quot; oscillation parameter of 1.1.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">osc_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        
+        <span class="c"># Positive fraction figure of merit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos_ctl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="n">hint_msg</span> <span class="o">=</span> <span class="s">&quot;Fraction of P(r) that is positive. &quot;</span>
+        <span class="n">hint_msg</span> <span class="o">+=</span> <span class="s">&quot;Theoretically, P(r) is defined positive.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">hint_msg</span><span class="p">)</span>
+        
+        <span class="c"># 1-simga positive fraction figure of merit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos_err_ctl</span> <span class="o">=</span> <span class="n">OutputTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+        <span class="n">message</span>  <span class="o">=</span> <span class="s">&quot;Fraction of P(r) that is at least 1 standard deviation&quot;</span>
+        <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot; greater than zero.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;This figure of merit tells you about the size of the &quot;</span>
+        <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;P(r) errors.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;If it is close to 1 and the other figures of merit are bad,&quot;</span>
+        <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot; consider changing the maximum distance.&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos_err_ctl</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
+        
+        <span class="n">sizer_res</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_rg</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">rg_ctl</span><span class="p">,</span>   <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_rg_unit</span><span class="p">,</span>   <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_iq0</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">iq0_ctl</span><span class="p">,</span>   <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_iq0_unit</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_bck</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bck_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_bck_unit</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_time</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">time_ctl</span><span class="p">,</span>   <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_time_unit</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_chi2</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">chi2_ctl</span><span class="p">,</span>   <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_osc</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">osc_ctl</span><span class="p">,</span>   <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_pos</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pos_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+
+        <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_pos_err</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">sizer_res</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pos_err_ctl</span><span class="p">,</span>  <span class="p">(</span><span class="n">iy</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+
+        <span class="n">ressizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_res</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">iy_vb</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">ressizer</span><span class="p">,</span> <span class="p">(</span><span class="n">iy_vb</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                 <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+
+        <span class="c"># ----- Buttons -----</span>
+        <span class="nb">id</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">NewId</span><span class="p">()</span>
+        <span class="n">button_OK</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="s">&quot;Compute&quot;</span><span class="p">)</span>
+        <span class="n">button_OK</span><span class="o">.</span><span class="n">SetToolTipString</span><span class="p">(</span><span class="s">&quot;Perform P(r) inversion.&quot;</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_invert</span><span class="p">,</span> <span class="nb">id</span> <span class="o">=</span> <span class="nb">id</span><span class="p">)</span>   
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_reset_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_set_save_flag</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="n">sizer_button</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>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_OK</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+       
+        <span class="n">iy_vb</span> <span class="o">+=</span> <span class="mi">1</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_button</span><span class="p">,</span> <span class="p">(</span><span class="n">iy_vb</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                 <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+
+        <span class="bp">self</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="bp">self</span><span class="o">.</span><span class="n">_on_invert</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_on_accept_alpha</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        User has accepted the estimated alpha, </span>
+<span class="sd">        set it as part of the input parameters</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">alpha</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+            <span class="n">tmp</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">alpha</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">alpha</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c"># No estimate or bad estimate, either do nothing</span>
+            <span class="c">#import sys</span>
+            <span class="k">print</span> <span class="s">&quot;InversionControl._on_accept_alpha: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="k">pass</span>
+    
+    <span class="k">def</span> <span class="nf">_on_accept_nterms</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        User has accepted the estimated number of terms, </span>
+<span class="sd">        set it as part of the input parameters</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">nterms</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span><span class="o">.</span><span class="n">GetLabel</span><span class="p">()</span>
+            <span class="n">tmp</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">nterms</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="n">nterms</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="c"># No estimate or bad estimate, either do nothing</span>
+            <span class="kn">import</span> <span class="nn">sys</span>
+            <span class="k">print</span> <span class="s">&quot;InversionControl._on_accept_nterms: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="k">pass</span>
+        
+<div class="viewcode-block" id="InversionControl.clear_panel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.InversionControl.clear_panel">[docs]</a>    <span class="k">def</span> <span class="nf">clear_panel</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">on_reset</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="InversionControl.on_reset"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.InversionControl.on_reset">[docs]</a>    <span class="k">def</span> <span class="nf">on_reset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Resets inversion parameters</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">DEFAULT_NFUNC</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">d_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">DEFAULT_DMAX</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">DEFAULT_ALPHA</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">time_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rg_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">iq0_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bck_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">chi2_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">osc_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos_err_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span><span class="o">.</span><span class="n">SetLabel</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_on_pars_changed</span><span class="p">()</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_on_pars_changed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Called when an input parameter has changed</span>
+<span class="sd">        We will estimate the alpha parameter behind the</span>
+<span class="sd">        scenes. </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="n">dmax</span><span class="p">,</span> <span class="n">nfunc</span><span class="p">,</span> <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="p">,</span> <span class="n">height</span><span class="p">,</span> <span class="n">width</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_read_pars</span><span class="p">()</span>
+        <span class="n">has_bck</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">bck_chk</span><span class="o">.</span><span class="n">IsChecked</span><span class="p">()</span>
+        
+        <span class="c"># If the pars are valid, estimate alpha</span>
+        <span class="k">if</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate_ctl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate_ctl</span><span class="o">.</span><span class="n">Enable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            
+            <span class="n">dataset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">dataset</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">dataset</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">estimate_plot_inversion</span><span class="p">(</span><span class="n">alpha</span><span class="o">=</span><span class="n">alpha</span><span class="p">,</span> <span class="n">nfunc</span><span class="o">=</span><span class="n">nfunc</span><span class="p">,</span> 
+                                                 <span class="n">d_max</span><span class="o">=</span><span class="n">dmax</span><span class="p">,</span>
+                                                 <span class="n">q_min</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span> <span class="n">q_max</span><span class="o">=</span><span class="n">qmax</span><span class="p">,</span>
+                                                 <span class="n">bck</span><span class="o">=</span><span class="n">has_bck</span><span class="p">,</span> 
+                                                 <span class="n">height</span><span class="o">=</span><span class="n">height</span><span class="p">,</span>
+                                                 <span class="n">width</span><span class="o">=</span><span class="n">width</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_read_pars</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>    
+        <span class="n">alpha</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">nfunc</span> <span class="o">=</span> <span class="mi">5</span>
+        <span class="n">dmax</span>  <span class="o">=</span> <span class="mi">120</span>
+        <span class="n">qmin</span>  <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">qmax</span>  <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">height</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">width</span>  <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="c"># Read slit height</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">height_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sheight_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">height_str</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">())</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">height</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">height</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">height_str</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sheight_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">sheight_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sheight_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">sheight_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            
+        <span class="c"># Read slit width</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">width_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">swidth_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">width_str</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">())</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
+                <span class="n">width</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">width</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">width_str</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">swidth_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">swidth_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">swidth_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">swidth_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        
+        <span class="c"># Read alpha</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">alpha</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">alpha_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        
+        <span class="c"># Read d_max    </span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">dmax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">dmax_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+            
+        <span class="c"># Read nfunc</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">nfunc</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="n">npts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">get_npts</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">npts</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">nfunc</span> <span class="o">&gt;</span> <span class="n">npts</span><span class="p">:</span>
+                <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;Number of function terms should be smaller &quot;</span>
+                <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;than the number of points&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="p">))</span>
+                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="n">message</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">nfunc_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        
+        <span class="c"># Read qmin</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">qmin_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">qmin_str</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">())</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">qmin</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">qmin</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">qmin_str</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmin_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        
+        <span class="c"># Read qmax</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">qmax_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">qmax_str</span><span class="o">.</span><span class="n">lstrip</span><span class="p">()</span><span class="o">.</span><span class="n">rstrip</span><span class="p">())</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">qmax</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">qmax</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">qmax_str</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">qmax_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        
+        <span class="k">return</span> <span class="n">flag</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="n">dmax</span><span class="p">,</span> <span class="n">nfunc</span><span class="p">,</span> <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="p">,</span> <span class="n">height</span><span class="p">,</span> <span class="n">width</span>
+    
+    <span class="k">def</span> <span class="nf">_on_explore</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Invoke the d_max exploration dialog</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">explore_dialog</span> <span class="kn">import</span> <span class="n">ExploreDialog</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">_last_pr</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">pr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">_create_plot_pr</span><span class="p">()</span>
+            <span class="n">dialog</span> <span class="o">=</span> <span class="n">ExploreDialog</span><span class="p">(</span><span class="n">pr</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">)</span>
+            <span class="n">dialog</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;No data to analyze. Please load a data set to proceed.&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="p">))</span>
+            
+    <span class="k">def</span> <span class="nf">_on_invert</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Perform inversion</span>
+<span class="sd">        </span>
+<span class="sd">        :param silent: when True, there will be no output for the user </span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Get the data from the form</span>
+        <span class="c"># Push it to the manager</span>
+        
+        <span class="n">flag</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="n">dmax</span><span class="p">,</span> <span class="n">nfunc</span><span class="p">,</span> <span class="n">qmin</span><span class="p">,</span> <span class="n">qmax</span><span class="p">,</span> <span class="n">height</span><span class="p">,</span> <span class="n">width</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_read_pars</span><span class="p">()</span>
+        <span class="n">has_bck</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">bck_chk</span><span class="o">.</span><span class="n">IsChecked</span><span class="p">()</span>
+        
+        <span class="k">if</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">dataset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span><span class="o">.</span><span class="n">GetValue</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">dataset</span><span class="o">==</span><span class="bp">None</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">dataset</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span><span class="o">==</span><span class="mi">0</span><span class="p">:</span>
+                <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;No data to invert. Select a data set before&quot;</span>
+                <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot; proceeding with P(r) inversion.&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">setup_plot_inversion</span><span class="p">(</span><span class="n">alpha</span><span class="o">=</span><span class="n">alpha</span><span class="p">,</span> <span class="n">nfunc</span><span class="o">=</span><span class="n">nfunc</span><span class="p">,</span> 
+                                                  <span class="n">d_max</span><span class="o">=</span><span class="n">dmax</span><span class="p">,</span>
+                                                  <span class="n">q_min</span><span class="o">=</span><span class="n">qmin</span><span class="p">,</span> <span class="n">q_max</span><span class="o">=</span><span class="n">qmax</span><span class="p">,</span>
+                                                  <span class="n">bck</span><span class="o">=</span><span class="n">has_bck</span><span class="p">,</span>
+                                                  <span class="n">height</span><span class="o">=</span><span class="n">height</span><span class="p">,</span>
+                                                  <span class="n">width</span><span class="o">=</span><span class="n">width</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;The P(r) form contains invalid values: &quot;</span>
+            <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;please submit it again.&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">_change_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">filepath</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Choose a new input file for I(q)</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">plot_data</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_manager</span><span class="o">.</span><span class="n">show_data</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="n">reset</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_on_pars_changed</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">_on_invert</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;InversionControl._change_file: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>                    
+</div>
+<div class="viewcode-block" id="HelpDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.HelpDialog">[docs]</a><span class="k">class</span> <span class="nc">HelpDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">sas.pr.invertor</span> <span class="kn">import</span> <span class="n">help</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">400</span><span class="p">,</span> <span class="mi">450</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="s">&quot;P(r) help&quot;</span><span class="p">)</span> 
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetWindowVariant</span><span class="p">(</span><span class="n">variant</span><span class="o">=</span><span class="n">FONT_VARIANT</span><span class="p">)</span>
+
+        <span class="n">vbox</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>
+
+        <span class="n">explanation</span> <span class="o">=</span> <span class="n">help</span><span class="p">()</span>
+           
+        <span class="n">label_explain</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">explanation</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">360</span><span class="p">,</span> <span class="mi">350</span><span class="p">))</span>
+            
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_explain</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+
+
+        <span class="n">static_line</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">static_line</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">EXPAND</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        
+        <span class="n">button_OK</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">,</span> <span class="s">&quot;OK&quot;</span><span class="p">)</span>
+        <span class="c">#button_Cancel = wx.Button(self, wx.ID_CANCEL, &quot;Cancel&quot;)</span>
+        
+        <span class="n">sizer_button</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>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_OK</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_button</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+</div>
+<div class="viewcode-block" id="PrDistDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.PrDistDialog">[docs]</a><span class="k">class</span> <span class="nc">PrDistDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Property dialog to let the user change the number</span>
+<span class="sd">    of points on the P(r) plot.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">):</span>
+        <span class="kn">from</span> <span class="nn">sas.pr.invertor</span> <span class="kn">import</span> <span class="n">help</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="nb">id</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">250</span><span class="p">,</span> <span class="mi">120</span><span class="p">))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetTitle</span><span class="p">(</span><span class="s">&quot;P(r) distribution&quot;</span><span class="p">)</span> 
+        
+
+        <span class="n">vbox</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>
+        
+        <span class="n">label_npts</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticText</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Number of points&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span> <span class="o">=</span> <span class="n">PrTextCtrl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">20</span><span class="p">))</span>
+                 
+        <span class="n">pars_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">pars_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">label_npts</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="n">pars_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">pars_sizer</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">ALL</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+
+        <span class="n">static_line</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">static_line</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">EXPAND</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        
+        <span class="n">button_OK</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">,</span> <span class="s">&quot;OK&quot;</span><span class="p">)</span>
+        <span class="bp">self</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_BUTTON</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_checkValues</span><span class="p">,</span> <span class="n">button_OK</span><span class="p">)</span>
+        <span class="n">button_Cancel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span> <span class="s">&quot;Cancel&quot;</span><span class="p">)</span>
+        
+        <span class="n">sizer_button</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>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_OK</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_Cancel</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>        
+        <span class="n">vbox</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">sizer_button</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">BOTTOM</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="n">vbox</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetAutoLayout</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">Layout</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">Centre</span><span class="p">()</span>
+
+    <span class="k">def</span> <span class="nf">_checkValues</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Check the dialog content.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">flag</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">flag</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="s">&quot;pink&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">Refresh</span><span class="p">()</span>
+        <span class="k">if</span> <span class="n">flag</span><span class="p">:</span>
+            <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+
+<div class="viewcode-block" id="PrDistDialog.get_content"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.PrDistDialog.get_content">[docs]</a>    <span class="k">def</span> <span class="nf">get_content</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return the content of the dialog.</span>
+<span class="sd">        At this point the values have already been</span>
+<span class="sd">        checked.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">value</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">GetValue</span><span class="p">())</span>
+        <span class="k">return</span> <span class="n">value</span>
+    </div>
+<div class="viewcode-block" id="PrDistDialog.set_content"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_panel.PrDistDialog.set_content">[docs]</a>    <span class="k">def</span> <span class="nf">set_content</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">npts</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialize the content of the dialog.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">npts_ctl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%i</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">npts</span><span class="p">)</span>
+
+<span class="c">##### testing code ############################################################</span></div></div>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Example: ::</span>
+
+<span class="sd">class TestPlot:</span>
+<span class="sd">    def __init__(self, text):</span>
+<span class="sd">        self.name = text</span>
+<span class="sd">    </span>
+<span class="sd">class MyApp(wx.App):</span>
+<span class="sd">    def OnInit(self):</span>
+<span class="sd">        wx.InitAllImageHandlers()</span>
+<span class="sd">        dialog = PrDistDialog(None, -1)</span>
+<span class="sd">        if dialog.ShowModal() == wx.ID_OK:</span>
+<span class="sd">            pass</span>
+<span class="sd">        dialog.Destroy()</span>
+<span class="sd">        </span>
+<span class="sd">        return 1</span>
+
+<span class="sd"># end of class MyApp</span>
+
+<span class="sd">if __name__ == &quot;__main__&quot;:</span>
+<span class="sd">    app = MyApp(0)</span>
+<span class="sd">    app.MainLoop()</span>
+<span class="sd">    </span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c">##### end of testing code #####################################################    </span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/pr/inversion_state.html
===================================================================
--- _modules/sas/perspectives/pr/inversion_state.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/pr/inversion_state.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,629 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.pr.inversion_state &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="Module code" href="../../../index.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" accesskey="U">Module code</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.pr.inversion_state</h1><div class="highlight"><pre>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Handling of P(r) inversion states</span>
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation. </span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+
+
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">logging</span>
+<span class="kn">from</span> <span class="nn">lxml</span> <span class="kn">import</span> <span class="n">etree</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">Data1D</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.readers.cansas_reader</span> <span class="kn">import</span> <span class="n">Reader</span> <span class="k">as</span> <span class="n">CansasReader</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.readers.cansas_reader</span> <span class="kn">import</span> <span class="n">get_content</span>
+
+<span class="n">PRNODE_NAME</span> <span class="o">=</span> <span class="s">&#39;pr_inversion&#39;</span>
+<span class="n">CANSAS_NS</span> <span class="o">=</span> <span class="s">&quot;cansas1d/1.0&quot;</span>
+
+<span class="c"># Translation of names between stored and object data</span>
+<span class="c">## List of P(r) inversion inputs </span>
+<span class="n">in_list</span> <span class="o">=</span>  <span class="p">[[</span><span class="s">&quot;nterms&quot;</span><span class="p">,</span>       <span class="s">&quot;nfunc&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;d_max&quot;</span><span class="p">,</span>        <span class="s">&quot;d_max&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;alpha&quot;</span><span class="p">,</span>        <span class="s">&quot;alpha&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;slit_width&quot;</span><span class="p">,</span>   <span class="s">&quot;width&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;slit_height&quot;</span><span class="p">,</span>  <span class="s">&quot;height&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;qmin&quot;</span><span class="p">,</span>         <span class="s">&quot;qmin&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;qmax&quot;</span><span class="p">,</span>         <span class="s">&quot;qmax&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;estimate_bck&quot;</span><span class="p">,</span> <span class="s">&quot;estimate_bck&quot;</span><span class="p">]]</span>                      
+
+<span class="c">## List of P(r) inversion outputs</span>
+<span class="n">out_list</span> <span class="o">=</span> <span class="p">[[</span><span class="s">&quot;elapsed&quot;</span><span class="p">,</span> <span class="s">&quot;elapsed&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;rg&quot;</span><span class="p">,</span>      <span class="s">&quot;rg&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;iq0&quot;</span><span class="p">,</span>     <span class="s">&quot;iq0&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;bck&quot;</span><span class="p">,</span>     <span class="s">&quot;bck&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;chi2&quot;</span><span class="p">,</span>    <span class="s">&quot;chi2&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;osc&quot;</span><span class="p">,</span>     <span class="s">&quot;osc&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;pos&quot;</span><span class="p">,</span>     <span class="s">&quot;pos&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;pos_err&quot;</span><span class="p">,</span> <span class="s">&quot;pos_err&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;alpha_estimate&quot;</span><span class="p">,</span> <span class="s">&quot;alpha_estimate&quot;</span><span class="p">],</span>
+           <span class="p">[</span><span class="s">&quot;nterms_estimate&quot;</span><span class="p">,</span> <span class="s">&quot;nterms_estimate&quot;</span><span class="p">]]</span>
+
+<div class="viewcode-block" id="InversionState"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_state.InversionState">[docs]</a><span class="k">class</span> <span class="nc">InversionState</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Class to hold the state information of the InversionControl panel.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Default values</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Input </span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">file</span>  <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">estimate_bck</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+        
+        <span class="c"># Inversion parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">d_max</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="c"># Slit parameters</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">height</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">width</span>  <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="c"># Q range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmin</span>  <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">qmax</span>  <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="c"># Outputs</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">elapsed</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">rg</span>    <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">iq0</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">bck</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">chi2</span>  <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">osc</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pos_err</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="c"># Estimates</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="c"># Data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">q</span>       <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">iq_obs</span>  <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">iq_calc</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="c"># Coefficients</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">coefficients</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">covariance</span> <span class="o">=</span> <span class="bp">None</span>
+    
+    <span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Pretty print</span>
+<span class="sd">        </span>
+<span class="sd">        :return: string representing the state</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">state</span>  <span class="o">=</span> <span class="s">&quot;File:         </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">file</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;Timestamp:    </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;Estimate bck: </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">estimate_bck</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;No. terms:    </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;D_max:        </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">d_max</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;Alpha:        </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">alpha</span><span class="p">)</span>
+        
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;Slit height:  </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">height</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;Slit width:   </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">width</span><span class="p">)</span>
+        
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;Qmin:         </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmin</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;Qmax:         </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">qmax</span><span class="p">)</span>
+        
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">Estimates:</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;  Alpha:      </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">alpha_estimate</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;  Nterms:     </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nterms_estimate</span><span class="p">)</span>
+        
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">Outputs:</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;  Elapsed:    </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">elapsed</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;  Rg:         </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">rg</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;  I(q=0):     </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">iq0</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;  Bck:        </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">bck</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;  Chi^2:      </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">chi2</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;  Oscillation:</span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">osc</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;  Positive:   </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pos</span><span class="p">)</span>
+        <span class="n">state</span> <span class="o">+=</span> <span class="s">&quot;  1-sigma pos:</span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pos_err</span><span class="p">)</span>
+        
+        <span class="k">return</span> <span class="n">state</span>
+        
+<div class="viewcode-block" id="InversionState.toXML"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_state.InversionState.toXML">[docs]</a>    <span class="k">def</span> <span class="nf">toXML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">file</span><span class="o">=</span><span class="s">&quot;pr_state.prv&quot;</span><span class="p">,</span> <span class="n">doc</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">entry_node</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Writes the state of the InversionControl panel to file, as XML.</span>
+<span class="sd">        </span>
+<span class="sd">        Compatible with standalone writing, or appending to an</span>
+<span class="sd">        already existing XML document. In that case, the XML document</span>
+<span class="sd">        is required. An optional entry node in the XML document </span>
+<span class="sd">        may also be given.</span>
+<span class="sd">        </span>
+<span class="sd">        :param file: file to write to</span>
+<span class="sd">        :param doc: XML document object [optional]</span>
+<span class="sd">        :param entry_node: XML node within the XML document at which </span>
+<span class="sd">            we will append the data [optional]</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#TODO: Get this to work</span>
+        <span class="kn">from</span> <span class="nn">xml.dom.minidom</span> <span class="kn">import</span> <span class="n">getDOMImplementation</span>
+
+        <span class="c"># Check whether we have to write a standalone XML file</span>
+        <span class="k">if</span> <span class="n">doc</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">impl</span> <span class="o">=</span> <span class="n">getDOMImplementation</span><span class="p">()</span>
+        
+            <span class="n">doc_type</span> <span class="o">=</span> <span class="n">impl</span><span class="o">.</span><span class="n">createDocumentType</span><span class="p">(</span><span class="n">PRNODE_NAME</span><span class="p">,</span> <span class="s">&quot;1.0&quot;</span><span class="p">,</span> <span class="s">&quot;1.0&quot;</span><span class="p">)</span>     
+        
+            <span class="n">newdoc</span> <span class="o">=</span> <span class="n">impl</span><span class="o">.</span><span class="n">createDocument</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="n">PRNODE_NAME</span><span class="p">,</span> <span class="n">doc_type</span><span class="p">)</span>
+            <span class="n">top_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">documentElement</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="c"># We are appending to an existing document</span>
+            <span class="n">newdoc</span> <span class="o">=</span> <span class="n">doc</span>
+            <span class="n">top_element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">PRNODE_NAME</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">entry_node</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">newdoc</span><span class="o">.</span><span class="n">documentElement</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">top_element</span><span class="p">)</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">entry_node</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">top_element</span><span class="p">)</span>
+            
+        <span class="n">attr</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createAttribute</span><span class="p">(</span><span class="s">&quot;version&quot;</span><span class="p">)</span>
+        <span class="n">attr</span><span class="o">.</span><span class="n">nodeValue</span> <span class="o">=</span> <span class="s">&#39;1.0&#39;</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">setAttributeNode</span><span class="p">(</span><span class="n">attr</span><span class="p">)</span>
+        
+        <span class="c"># File name</span>
+        <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;filename&quot;</span><span class="p">)</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">file</span><span class="p">)))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="nb">file</span><span class="p">)))</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+        
+        <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;timestamp&quot;</span><span class="p">)</span>
+        <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">ctime</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span><span class="p">)))</span>
+        <span class="n">attr</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createAttribute</span><span class="p">(</span><span class="s">&quot;epoch&quot;</span><span class="p">)</span>
+        <span class="n">attr</span><span class="o">.</span><span class="n">nodeValue</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span><span class="p">)</span>
+        <span class="n">element</span><span class="o">.</span><span class="n">setAttributeNode</span><span class="p">(</span><span class="n">attr</span><span class="p">)</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+        
+        <span class="c"># Inputs</span>
+        <span class="n">inputs</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;inputs&quot;</span><span class="p">)</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">inputs</span><span class="p">)</span>
+        
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">in_list</span><span class="p">:</span>
+            <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="n">cmd</span> <span class="o">=</span> <span class="s">&quot;element.appendChild(newdoc.createTextNode(str(self.</span><span class="si">%s</span><span class="s">)))&quot;</span>
+            <span class="k">exec</span>  <span class="n">cmd</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            <span class="n">inputs</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+              
+        <span class="c"># Outputs</span>
+        <span class="n">outputs</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;outputs&quot;</span><span class="p">)</span>
+        <span class="n">top_element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">outputs</span><span class="p">)</span>
+        
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">out_list</span><span class="p">:</span>
+            <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="n">cmd</span> <span class="o">=</span> <span class="s">&quot;element.appendChild(newdoc.createTextNode(str(self.</span><span class="si">%s</span><span class="s">)))&quot;</span>
+            <span class="k">exec</span>  <span class="n">cmd</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            <span class="n">outputs</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+                    
+        <span class="c"># Save output coefficients and its covariance matrix</span>
+        <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;coefficients&quot;</span><span class="p">)</span>
+        <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">coefficients</span><span class="p">)))</span>
+        <span class="n">outputs</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+        <span class="n">element</span> <span class="o">=</span> <span class="n">newdoc</span><span class="o">.</span><span class="n">createElement</span><span class="p">(</span><span class="s">&quot;covariance&quot;</span><span class="p">)</span>
+        <span class="n">element</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">createTextNode</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">covariance</span><span class="p">)))</span>
+        <span class="n">outputs</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">element</span><span class="p">)</span>
+                    
+        <span class="c"># Save the file</span>
+        <span class="k">if</span> <span class="n">doc</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">fd</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="nb">file</span><span class="p">,</span> <span class="s">&#39;w&#39;</span><span class="p">)</span>
+            <span class="n">fd</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">newdoc</span><span class="o">.</span><span class="n">toprettyxml</span><span class="p">())</span>
+            <span class="n">fd</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">newdoc</span>
+</div>
+<div class="viewcode-block" id="InversionState.fromXML"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_state.InversionState.fromXML">[docs]</a>    <span class="k">def</span> <span class="nf">fromXML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">file</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">node</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Load a P(r) inversion state from a file</span>
+<span class="sd">        </span>
+<span class="sd">        :param file: .prv file</span>
+<span class="sd">        :param node: node of a XML document to read from</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="nb">file</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;InversionState no longer supports non-CanSAS&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; format for P(r) files&quot;</span>
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">msg</span>
+            
+        <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;version&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;version&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="s">&#39;1.0&#39;</span><span class="p">:</span>
+            
+            <span class="c"># Get file name</span>
+            <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:filename&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="n">entry</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+            
+            <span class="c"># Get time stamp</span>
+            <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:timestamp&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">entry</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;epoch&#39;</span><span class="p">):</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">timestamp</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">entry</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;epoch&#39;</span><span class="p">))</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;InversionState.fromXML: Could not read &quot;</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;timestamp</span><span class="se">\n</span><span class="s"> </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                    <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+            
+            <span class="c"># Parse inversion inputs</span>
+            <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:inputs&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">in_list</span><span class="p">:</span>
+                    <span class="n">input_field</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">entry</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">input_field</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="n">cmd</span> <span class="o">=</span> <span class="s">&#39;self.</span><span class="si">%s</span><span class="s"> = float(input_field.text.strip())&#39;</span> 
+                            <span class="k">exec</span>  <span class="n">cmd</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="k">exec</span> <span class="s">&#39;self.</span><span class="si">%s</span><span class="s"> = None&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                <span class="n">input_field</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:estimate_bck&#39;</span><span class="p">,</span> <span class="n">entry</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">input_field</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="k">try</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">estimate_bck</span> <span class="o">=</span> <span class="n">input_field</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">==</span><span class="s">&#39;True&#39;</span>
+                    <span class="k">except</span><span class="p">:</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">estimate_bck</span> <span class="o">=</span> <span class="bp">False</span>
+                    
+            <span class="c"># Parse inversion outputs</span>
+            <span class="n">entry</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:outputs&#39;</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">entry</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="c"># Output parameters (scalars)</span>
+                <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">out_list</span><span class="p">:</span>
+                    <span class="n">input_field</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">entry</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">input_field</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="n">cmd</span> <span class="o">=</span> <span class="s">&#39;self.</span><span class="si">%s</span><span class="s"> = float(input_field.text.strip())&#39;</span>
+                            <span class="k">exec</span>  <span class="n">cmd</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="k">exec</span> <span class="s">&#39;self.</span><span class="si">%s</span><span class="s"> = None&#39;</span> <span class="o">%</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
+            
+                <span class="c"># Look for coefficients</span>
+                <span class="c"># Format is [value, value, value, value]</span>
+                <span class="n">coeff</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:coefficients&#39;</span><span class="p">,</span> <span class="n">entry</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">coeff</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="c"># Remove brackets</span>
+                    <span class="n">c_values</span> <span class="o">=</span> <span class="n">coeff</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">.</span><span class="n">replace</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>
+                    <span class="n">c_values</span> <span class="o">=</span> <span class="n">c_values</span><span class="o">.</span><span class="n">replace</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>
+                    <span class="n">toks</span> <span class="o">=</span> <span class="n">c_values</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">coefficients</span> <span class="o">=</span> <span class="p">[]</span>
+                    <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">toks</span><span class="p">:</span>
+                        <span class="k">try</span><span class="p">:</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">coefficients</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">c</span><span class="p">))</span>
+                        <span class="k">except</span><span class="p">:</span>
+                            <span class="c"># Bad data, skip. We will count the number of </span>
+                            <span class="c"># coefficients at the very end and deal with </span>
+                            <span class="c"># inconsistencies then.</span>
+                            <span class="k">pass</span>
+                    <span class="c"># Sanity check</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">coefficients</span><span class="p">)</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">:</span>
+                        <span class="c"># Inconsistent number of coefficients.</span>
+                        <span class="c"># Don&#39;t keep the data.</span>
+                        <span class="n">err_msg</span> <span class="o">=</span> <span class="s">&quot;InversionState.fromXML: inconsistant &quot;</span>
+                        <span class="n">err_msg</span> <span class="o">+=</span> <span class="s">&quot;number of coefficients: &quot;</span>
+                        <span class="n">err_msg</span> <span class="o">+=</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="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">coefficients</span><span class="p">),</span>
+                                              <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">)</span>
+                        <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">err_msg</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">coefficients</span> <span class="o">=</span> <span class="bp">None</span>
+                
+                <span class="c"># Look for covariance matrix</span>
+                <span class="c"># Format is [ [value, value], [value, value] ]</span>
+                <span class="n">coeff</span> <span class="o">=</span> <span class="n">get_content</span><span class="p">(</span><span class="s">&#39;ns:covariance&#39;</span><span class="p">,</span> <span class="n">entry</span><span class="p">)</span>
+                <span class="k">if</span> <span class="n">coeff</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="c"># Parse rows</span>
+                    <span class="n">rows</span> <span class="o">=</span> <span class="n">coeff</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</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>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">covariance</span> <span class="o">=</span> <span class="p">[]</span>
+                    <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">rows</span><span class="p">:</span>
+                        <span class="n">row</span> <span class="o">=</span> <span class="n">row</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
+                        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">row</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="k">continue</span>
+                        <span class="c"># Remove end bracket</span>
+                        <span class="n">row</span> <span class="o">=</span> <span class="n">row</span><span class="o">.</span><span class="n">replace</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>
+                        <span class="n">c_values</span> <span class="o">=</span> <span class="n">row</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
+                        <span class="n">cov_row</span> <span class="o">=</span> <span class="p">[]</span>
+                        <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">c_values</span><span class="p">:</span>
+                            <span class="k">try</span><span class="p">:</span>
+                                <span class="n">cov_row</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">c</span><span class="p">))</span>
+                            <span class="k">except</span><span class="p">:</span>
+                                <span class="c"># Bad data, skip. We will count the number of </span>
+                                <span class="c"># coefficients at the very end and deal with </span>
+                                <span class="c"># inconsistencies then.</span>
+                                <span class="k">pass</span>
+                        <span class="c"># Sanity check: check the number of entries in the row</span>
+                        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">cov_row</span><span class="p">)</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">:</span>
+                            <span class="bp">self</span><span class="o">.</span><span class="n">covariance</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cov_row</span><span class="p">)</span>
+                    <span class="c"># Sanity check: check the number of rows in the covariance</span>
+                    <span class="c"># matrix</span>
+                    <span class="k">if</span> <span class="ow">not</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">covariance</span><span class="p">)</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">:</span>
+                        <span class="c"># Inconsistent dimensions of the covariance matrix.</span>
+                        <span class="c"># Don&#39;t keep the data.</span>
+                        <span class="n">err_msg</span> <span class="o">=</span> <span class="s">&quot;InversionState.fromXML: &quot;</span>
+                        <span class="n">err_msg</span> <span class="o">+=</span> <span class="s">&quot;inconsistant dimensions of the &quot;</span>
+                        <span class="n">err_msg</span> <span class="o">+=</span> <span class="s">&quot; covariance matrix: &quot;</span>
+                        <span class="n">err_msg</span> <span class="o">+=</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="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">covariance</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">)</span>
+                        <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">err_msg</span><span class="p">)</span>
+                        <span class="bp">self</span><span class="o">.</span><span class="n">covariance</span> <span class="o">=</span> <span class="bp">None</span>
+    </div></div>
+<div class="viewcode-block" id="Reader"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_state.Reader">[docs]</a><span class="k">class</span> <span class="nc">Reader</span><span class="p">(</span><span class="n">CansasReader</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Class to load a .prv P(r) inversion file</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="c">## File type</span>
+    <span class="n">type_name</span> <span class="o">=</span> <span class="s">&quot;P(r)&quot;</span>
+    
+    <span class="c">## Wildcards</span>
+    <span class="nb">type</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;P(r) files (*.prv)|*.prv&quot;</span><span class="p">,</span>
+            <span class="s">&quot;SASView files (*.svs)|*.svs&quot;</span><span class="p">]</span>
+    <span class="c">## List of allowed extensions</span>
+    <span class="n">ext</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;.prv&#39;</span><span class="p">,</span> <span class="s">&#39;.PRV&#39;</span><span class="p">,</span> <span class="s">&#39;.svs&#39;</span><span class="p">,</span> <span class="s">&#39;.SVS&#39;</span><span class="p">]</span>  
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">call_back</span><span class="p">,</span> <span class="n">cansas</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Initialize the call-back method to be called</span>
+<span class="sd">        after we load a file</span>
+<span class="sd">        </span>
+<span class="sd">        :param call_back: call-back method</span>
+<span class="sd">        :param cansas:  True = files will be written/read in CanSAS format</span>
+<span class="sd">                        False = write CanSAS format</span>
+<span class="sd">            </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">## Call back method to be executed after a file is read</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">call_back</span> <span class="o">=</span> <span class="n">call_back</span>
+        <span class="c">## CanSAS format flag</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">cansas</span> <span class="o">=</span> <span class="n">cansas</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>
+        
+<div class="viewcode-block" id="Reader.read"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_state.Reader.read">[docs]</a>    <span class="k">def</span> <span class="nf">read</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Load a new P(r) inversion state from file</span>
+<span class="sd">        </span>
+<span class="sd">        :param path: file path</span>
+<span class="sd">        </span>
+<span class="sd">        :return: None</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cansas</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_read_cansas</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_read_standalone</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+        </div>
+    <span class="k">def</span> <span class="nf">_read_standalone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Load a new P(r) inversion state from file.</span>
+<span class="sd">        The P(r) node is assumed to be the top element.</span>
+<span class="sd">        </span>
+<span class="sd">        :param path: file path</span>
+<span class="sd">        </span>
+<span class="sd">        :return: None</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Read the new state from file</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="n">InversionState</span><span class="p">()</span>
+        <span class="n">state</span><span class="o">.</span><span class="n">fromXML</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="n">path</span><span class="p">)</span>
+        
+        <span class="c"># Call back to post the new state</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state</span> <span class="o">=</span> <span class="n">state</span>
+        <span class="c">#self.call_back(state)</span>
+        <span class="k">return</span> <span class="bp">None</span>
+    
+    <span class="k">def</span> <span class="nf">_parse_prstate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">entry</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Read a p(r) inversion result from an XML node</span>
+<span class="sd">        </span>
+<span class="sd">        :param entry: XML node to read from </span>
+<span class="sd">        </span>
+<span class="sd">        :return: InversionState object</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">state</span> <span class="o">=</span> <span class="bp">None</span>
+        
+        <span class="c"># Locate the P(r) node</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">nodes</span> <span class="o">=</span> <span class="n">entry</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;ns:</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">PRNODE_NAME</span><span class="p">,</span>
+                                <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+            <span class="k">if</span> <span class="n">nodes</span> <span class="o">!=</span><span class="p">[]:</span>
+                <span class="c"># Create an empty state</span>
+                <span class="n">state</span> <span class="o">=</span>  <span class="n">InversionState</span><span class="p">()</span>
+                <span class="n">state</span><span class="o">.</span><span class="n">fromXML</span><span class="p">(</span><span class="n">node</span><span class="o">=</span><span class="n">nodes</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;XML document does not contain P(r) &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;information.</span><span class="se">\n</span><span class="s"> </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+            <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
+            
+        <span class="k">return</span> <span class="n">state</span>
+    
+    <span class="k">def</span> <span class="nf">_read_cansas</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot; </span>
+<span class="sd">        Load data and P(r) information from a CanSAS XML file.</span>
+<span class="sd">        </span>
+<span class="sd">        :param path: file path</span>
+<span class="sd">        </span>
+<span class="sd">        :return: Data1D object if a single SASentry was found, </span>
+<span class="sd">                    or a list of Data1D objects if multiple entries were found,</span>
+<span class="sd">                    or None of nothing was found</span>
+<span class="sd">                    </span>
+<span class="sd">        :raise RuntimeError: when the file can&#39;t be opened</span>
+<span class="sd">        :raise ValueError: when the length of the data vectors are inconsistent</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">output</span> <span class="o">=</span> <span class="p">[]</span>
+        
+        <span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
+            <span class="n">basename</span>  <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
+            <span class="n">root</span><span class="p">,</span> <span class="n">extension</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">basename</span><span class="p">)</span>
+            <span class="c">#TODO: eventually remove the check for .xml once</span>
+            <span class="c"># the P(r) writer/reader is truly complete.</span>
+            <span class="k">if</span>  <span class="n">extension</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">ext</span> <span class="ow">or</span> <span class="n">extension</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s">&#39;.xml&#39;</span><span class="p">:</span>
+                
+                <span class="n">tree</span> <span class="o">=</span> <span class="n">etree</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">parser</span><span class="o">=</span><span class="n">etree</span><span class="o">.</span><span class="n">ETCompatXMLParser</span><span class="p">())</span>
+                <span class="c"># Check the format version number</span>
+                <span class="c"># Specifying the namespace will take care of the file </span>
+                <span class="c">#format version </span>
+                <span class="n">root</span> <span class="o">=</span> <span class="n">tree</span><span class="o">.</span><span class="n">getroot</span><span class="p">()</span>
+                
+                <span class="n">entry_list</span> <span class="o">=</span> <span class="n">root</span><span class="o">.</span><span class="n">xpath</span><span class="p">(</span><span class="s">&#39;/ns:SASroot/ns:SASentry&#39;</span><span class="p">,</span>
+                                        <span class="n">namespaces</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;ns&#39;</span><span class="p">:</span> <span class="n">CANSAS_NS</span><span class="p">})</span>
+
+                <span class="k">for</span> <span class="n">entry</span> <span class="ow">in</span> <span class="n">entry_list</span><span class="p">:</span>
+                    <span class="n">sas_entry</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_entry</span><span class="p">(</span><span class="n">entry</span><span class="p">)</span>
+                    <span class="n">prstate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_prstate</span><span class="p">(</span><span class="n">entry</span><span class="p">)</span>
+                    <span class="c">#prstate could be None when .svs file is loaded</span>
+                    <span class="c">#in this case, skip appending to output</span>
+                    <span class="k">if</span> <span class="n">prstate</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="n">sas_entry</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;prstate&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">prstate</span>
+                        <span class="n">sas_entry</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="n">prstate</span><span class="o">.</span><span class="n">file</span>
+                        <span class="n">output</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sas_entry</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> is not a file&quot;</span> <span class="o">%</span> <span class="n">path</span>
+        
+        <span class="c"># Return output consistent with the loader&#39;s api</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">output</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">output</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="c"># Call back to post the new state</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">call_back</span><span class="p">(</span><span class="n">output</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;prstate&#39;</span><span class="p">],</span> <span class="n">datainfo</span> <span class="o">=</span> <span class="n">output</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+            <span class="c">#self.state = output[0].meta_data[&#39;prstate&#39;]</span>
+            <span class="k">return</span> <span class="n">output</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="n">output</span>                
+    
+    
+<div class="viewcode-block" id="Reader.write"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_state.Reader.write">[docs]</a>    <span class="k">def</span> <span class="nf">write</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">prstate</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Write the content of a Data1D as a CanSAS XML file</span>
+<span class="sd">        </span>
+<span class="sd">        :param filename: name of the file to write</span>
+<span class="sd">        :param datainfo: Data1D object</span>
+<span class="sd">        :param prstate: InversionState object</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Sanity check</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cansas</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+            <span class="n">doc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">write_toXML</span><span class="p">(</span><span class="n">datainfo</span><span class="p">,</span> <span class="n">prstate</span><span class="p">)</span>        
+            <span class="c"># Write the XML document</span>
+            <span class="n">fd</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>
+            <span class="n">fd</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">toprettyxml</span><span class="p">())</span>
+            <span class="n">fd</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">prstate</span><span class="o">.</span><span class="n">toXML</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="n">filename</span><span class="p">)</span>
+        </div>
+<div class="viewcode-block" id="Reader.write_toXML"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.inversion_state.Reader.write_toXML">[docs]</a>    <span class="k">def</span> <span class="nf">write_toXML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Write toXML, a helper for write()</span>
+<span class="sd">        </span>
+<span class="sd">        : return: xml doc</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">datainfo</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">datainfo</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="p">[],</span> <span class="n">y</span><span class="o">=</span><span class="p">[])</span>    
+        <span class="k">elif</span> <span class="ow">not</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">):</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;The cansas writer expects a Data1D &quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;instance: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">datainfo</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">msg</span>
+    
+        <span class="c"># Create basic XML document</span>
+        <span class="n">doc</span><span class="p">,</span> <span class="n">sasentry</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_to_xml_doc</span><span class="p">(</span><span class="n">datainfo</span><span class="p">)</span>
+        
+        <span class="c"># Add the invariant information to the XML document</span>
+        <span class="k">if</span> <span class="n">state</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">doc</span> <span class="o">=</span> <span class="n">state</span><span class="o">.</span><span class="n">toXML</span><span class="p">(</span><span class="n">doc</span><span class="o">=</span><span class="n">doc</span><span class="p">,</span> <span class="n">entry_node</span><span class="o">=</span><span class="n">sasentry</span><span class="p">)</span>
+            
+        <span class="k">return</span> <span class="n">doc</span> 
+    </div></div>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/pr/pr.html
===================================================================
--- _modules/sas/perspectives/pr/pr.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/pr/pr.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,1480 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.pr.pr &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="Module code" href="../../../index.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" accesskey="U">Module code</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.pr.pr</h1><div class="highlight"><pre>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation. </span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+
+
+<span class="c"># Make sure the option of saving each curve is available </span>
+<span class="c"># Use the I(q) curve as input and compare the output to P(r)</span>
+
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">logging</span>
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">import</span> <span class="nn">math</span>
+<span class="kn">import</span> <span class="nn">numpy</span>
+<span class="kn">import</span> <span class="nn">pylab</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.gui_manager</span> <span class="kn">import</span> <span class="n">MDIFrame</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.dataFitting</span> <span class="kn">import</span> <span class="n">Data1D</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">NewPlotEvent</span>
+<span class="kn">from</span> <span class="nn">sas.guiframe.events</span> <span class="kn">import</span> <span class="n">StatusEvent</span> 
+<span class="kn">from</span> <span class="nn">sas.guiframe.gui_style</span> <span class="kn">import</span> <span class="n">GUIFRAME_ID</span>   
+<span class="kn">from</span> <span class="nn">sas.pr.invertor</span> <span class="kn">import</span> <span class="n">Invertor</span>
+<span class="kn">from</span> <span class="nn">sas.dataloader.loader</span> <span class="kn">import</span> <span class="n">Loader</span>
+<span class="kn">import</span> <span class="nn">sas.dataloader</span>
+
+<span class="kn">from</span> <span class="nn">pr_widgets</span> <span class="kn">import</span> <span class="n">load_error</span> 
+<span class="kn">from</span> <span class="nn">sas.guiframe.plugin_base</span> <span class="kn">import</span> <span class="n">PluginBase</span>
+
+
+<span class="n">PR_FIT_LABEL</span>       <span class="o">=</span> <span class="s">r&quot;$P_{fit}(r)$&quot;</span>
+<span class="n">PR_LOADED_LABEL</span>    <span class="o">=</span> <span class="s">r&quot;$P_{loaded}(r)$&quot;</span>
+<span class="n">IQ_DATA_LABEL</span>      <span class="o">=</span> <span class="s">r&quot;$I_{obs}(q)$&quot;</span>
+<span class="n">IQ_FIT_LABEL</span>       <span class="o">=</span> <span class="s">r&quot;$I_{fit}(q)$&quot;</span>
+<span class="n">IQ_SMEARED_LABEL</span>   <span class="o">=</span> <span class="s">r&quot;$I_{smeared}(q)$&quot;</span>
+<span class="n">GROUP_ID_IQ_DATA</span> <span class="o">=</span> <span class="s">r&quot;$I_{obs}(q)$&quot;</span>
+<span class="n">GROUP_ID_PR_FIT</span> <span class="o">=</span> <span class="s">r&quot;$P_{fit}(r)$&quot;</span>
+
+
+
+<span class="k">class</span> <span class="nc">Plugin</span><span class="p">(</span><span class="n">PluginBase</span><span class="p">):</span>
+<div class="viewcode-block" id="Plugin"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        P(r) inversion perspective</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">DEFAULT_ALPHA</span> <span class="o">=</span> <span class="mf">0.0001</span>
+    <span class="n">DEFAULT_NFUNC</span> <span class="o">=</span> <span class="mi">10</span>
+    <span class="n">DEFAULT_DMAX</span>  <span class="o">=</span> <span class="mf">140.0</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">standalone</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
+        <span class="n">PluginBase</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">&quot;Pr Inversion&quot;</span><span class="p">,</span> <span class="n">standalone</span><span class="o">=</span><span class="n">standalone</span><span class="p">)</span>
+        <span class="c">## Simulation window manager</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">simview</span> <span class="o">=</span> <span class="bp">None</span>
+       
+        <span class="c">## State data</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span>      <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">DEFAULT_ALPHA</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span>      <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">DEFAULT_NFUNC</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">max_length</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">DEFAULT_DMAX</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">q_min</span>      <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">q_max</span>      <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">has_bck</span>    <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_height</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_width</span>  <span class="o">=</span> <span class="mi">0</span>
+        <span class="c">## Remember last plottable processed</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">last_data</span>  <span class="o">=</span> <span class="s">&quot;sphere_60_q0_2.txt&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_current_file_data</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## Time elapsed for last computation [sec]</span>
+        <span class="c"># Start with a good default</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">elapsed</span> <span class="o">=</span> <span class="mf">0.022</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">iq_data_shown</span> <span class="o">=</span> <span class="bp">False</span>
+        
+        <span class="c">## Current invertor</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">invertor</span>    <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pr</span>          <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">data_id</span> <span class="o">=</span> <span class="n">IQ_DATA_LABEL</span> 
+        <span class="c"># Copy of the last result in case we need to display it.</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_last_pr</span>    <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_last_out</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_last_cov</span>   <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## Calculation thread</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">calc_thread</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## Estimation thread</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## Result panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## Currently views plottable</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c">## Number of P(r) points to display on the output plot</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_pr_npts</span> <span class="o">=</span> <span class="mi">51</span>
+        <span class="c">## Flag to let the plug-in know that it is running standalone</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">standalone</span> <span class="o">=</span> <span class="n">standalone</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_normalize_output</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_scale_output_unity</span> <span class="o">=</span> <span class="bp">False</span>
+        
+        <span class="c">## List of added P(r) plots</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span> <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_default_Iq</span>  <span class="o">=</span> <span class="p">{}</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_plot_id</span> <span class="o">=</span> <span class="p">[]</span>
+        
+        <span class="c"># Associate the inversion state reader with .prv files</span>
+        <span class="kn">from</span> <span class="nn">inversion_state</span> <span class="kn">import</span> <span class="n">Reader</span>
+         
+        <span class="c"># Create a CanSAS/Pr reader</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">state_reader</span> <span class="o">=</span> <span class="n">Reader</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">set_state</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_extensions</span> <span class="o">=</span> <span class="s">&#39;.prv&#39;</span>
+        <span class="n">l</span> <span class="o">=</span> <span class="n">Loader</span><span class="p">()</span>
+        <span class="n">l</span><span class="o">.</span><span class="n">associate_file_reader</span><span class="p">(</span><span class="s">&#39;.prv&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">state_reader</span><span class="p">)</span>
+        <span class="c">#l.associate_file_reader(&quot;.svs&quot;, self.state_reader)</span>
+                
+        <span class="c"># Log startup</span>
+        <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Pr(r) plug-in started&quot;</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">delete_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_id</span><span class="p">):</span>
+<div class="viewcode-block" id="Plugin.delete_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.delete_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        delete the data association with prview</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">clear_panel</span><span class="p">()</span>
+       
+    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.get_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Returns the current data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span>
+    
+    <span class="k">def</span> <span class="nf">set_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">state</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">datainfo</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.set_state"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.set_state">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Call-back method for the inversion state reader.</span>
+<span class="sd">        This method is called when a .prv file is loaded.</span>
+<span class="sd">        </span>
+<span class="sd">        :param state: InversionState object</span>
+<span class="sd">        :param datainfo: Data1D object [optional]</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">datainfo</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;list&#39;</span><span class="p">:</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">datainfo</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">1</span><span class="p">:</span>
+                    <span class="n">data</span> <span class="o">=</span> <span class="n">datainfo</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">datainfo</span>
+            <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">=</span>  <span class="s">&quot;Pr.set_state: datainfo parameter cannot &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;be None in standalone mode&quot;</span>
+                <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">msg</span>
+            
+            <span class="c"># Ensuring that plots are coordinated correctly</span>
+            <span class="n">t</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">localtime</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;prstate&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">timestamp</span><span class="p">)</span>
+            <span class="n">time_str</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&quot;%b </span><span class="si">%d</span><span class="s"> %H:%M&quot;</span><span class="p">,</span> <span class="n">t</span><span class="p">)</span>
+            
+            <span class="c"># Check that no time stamp is already appended</span>
+            <span class="n">max_char</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;prstate&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">file</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&quot;[&quot;</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">max_char</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">max_char</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;prstate&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">file</span><span class="p">)</span>
+            
+            <span class="n">datainfo</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;prstate&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span>\
+                <span class="n">data</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;prstate&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">file</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="n">max_char</span><span class="p">]</span>\
+                <span class="o">+</span> <span class="s">&#39; [&#39;</span> <span class="o">+</span> <span class="n">time_str</span> <span class="o">+</span> <span class="s">&#39;]&#39;</span>
+            
+            <span class="n">data</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;prstate&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">file</span>
+            <span class="c"># TODO:</span>
+            <span class="c">#remove this call when state save all information about the gui data</span>
+            <span class="c"># such as ID , Group_ID, etc...</span>
+            <span class="c">#make self.current_plottable = datainfo directly</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">create_gui_data</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">meta_data</span><span class="p">[</span><span class="s">&#39;prstate&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">file</span>
+            
+            <span class="c"># Make sure the user sees the P(r) panel after loading</span>
+            <span class="c">#self.parent.set_perspective(self.perspective)  </span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">on_perspective</span><span class="p">(</span><span class="n">event</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>   
+            <span class="c"># Load the P(r) results</span>
+            <span class="c">#state = self.state_reader.get_state()</span>
+            <span class="n">data_dict</span> <span class="o">=</span> <span class="p">{</span><span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="o">.</span><span class="n">id</span><span class="p">:</span><span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="p">}</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="n">data_list</span><span class="o">=</span><span class="n">data_dict</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="p">,</span>
+                                        <span class="n">title</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="o">.</span><span class="n">title</span><span class="p">))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">set_state</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;prview.set_state: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+
+  
+    <span class="k">def</span> <span class="nf">help</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.help"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.help">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show a general help dialog. </span>
+<span class="sd">        </span>
+<span class="sd">        :TODO: replace the text with a nice image</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">inversion_panel</span> <span class="kn">import</span> <span class="n">HelpDialog</span>
+        <span class="n">dialog</span> <span class="o">=</span> <span class="n">HelpDialog</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">dialog</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="n">dialog</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">dialog</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+    
+    <span class="k">def</span> <span class="nf">_fit_pr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span></div>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Generate P(r) for sphere</span>
+        <span class="n">radius</span> <span class="o">=</span> <span class="mf">60.0</span>
+        <span class="n">d_max</span>  <span class="o">=</span> <span class="mi">2</span><span class="o">*</span><span class="n">radius</span>
+        
+        <span class="n">r</span> <span class="o">=</span> <span class="n">pylab</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mf">0.01</span><span class="p">,</span> <span class="n">d_max</span><span class="p">,</span> <span class="n">d_max</span><span class="o">/</span><span class="mf">51.0</span><span class="p">)</span>
+        <span class="n">M</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">r</span><span class="p">)</span>
+        <span class="n">y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">M</span><span class="p">)</span>
+        <span class="n">pr_err</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">M</span><span class="p">)</span>
+        
+        <span class="nb">sum</span> <span class="o">=</span> <span class="mf">0.0</span>
+        <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">M</span><span class="p">):</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr_theory</span><span class="p">(</span><span class="n">r</span><span class="p">[</span><span class="n">j</span><span class="p">],</span> <span class="n">radius</span><span class="p">)</span>
+            <span class="nb">sum</span> <span class="o">+=</span> <span class="n">value</span>
+            <span class="n">y</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
+            <span class="n">pr_err</span><span class="p">[</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">y</span><span class="p">[</span><span class="n">j</span><span class="p">])</span>
+
+        <span class="n">y</span> <span class="o">=</span> <span class="n">y</span><span class="o">/</span><span class="nb">sum</span><span class="o">*</span><span class="n">d_max</span><span class="o">/</span><span class="nb">len</span><span class="p">(</span><span class="n">r</span><span class="p">)</span>
+
+        <span class="c"># Perform fit</span>
+        <span class="n">pr</span> <span class="o">=</span> <span class="n">Invertor</span><span class="p">()</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">d_max</span> <span class="o">=</span> <span class="n">d_max</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">r</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">y</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">err</span> <span class="o">=</span> <span class="n">pr_err</span>
+        <span class="n">out</span><span class="p">,</span> <span class="n">cov</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">pr_fit</span><span class="p">()</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">out</span><span class="p">)):</span>
+            <span class="k">print</span> <span class="s">&quot;</span><span class="si">%g</span><span class="s"> +- </span><span class="si">%g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">out</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">cov</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">i</span><span class="p">]))</span>
+        
+        <span class="c"># Show input P(r)</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="s">&quot;Pr&quot;</span>
+        <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">pr</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">pr</span><span class="o">.</span><span class="n">y</span><span class="p">,</span> <span class="n">dy</span><span class="o">=</span><span class="n">pr</span><span class="o">.</span><span class="n">err</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;P_{obs}(r)&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{r}&quot;</span><span class="p">,</span> <span class="s">&#39;A&#39;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{P(r)} &quot;</span><span class="p">,</span><span class="s">&quot;cm^{-3}&quot;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="s">&quot;P_{obs}(r)&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="s">&quot;P_{obs}(r)&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="n">title</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data_id</span><span class="p">,</span>  <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">))</span>
+
+        <span class="c"># Show P(r) fit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_pr</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">pr</span><span class="p">)</span>
+        
+        <span class="c"># Show I(q) fit</span>
+        <span class="n">q</span> <span class="o">=</span> <span class="n">pylab</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mf">0.001</span><span class="p">,</span> <span class="mf">0.1</span><span class="p">,</span> <span class="mf">0.01</span><span class="o">/</span><span class="mf">51.0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_iq</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">pr</span><span class="p">,</span> <span class="n">q</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">show_shpere</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">radius</span><span class="o">=</span><span class="mf">70.0</span><span class="p">,</span> <span class="n">x_range</span><span class="o">=</span><span class="mf">70.0</span><span class="p">):</span>
+<div class="viewcode-block" id="Plugin.show_shpere"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.show_shpere">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Show P(r)</span>
+        <span class="n">y_true</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+
+        <span class="n">sum_true</span> <span class="o">=</span> <span class="mf">0.0</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">)):</span>
+            <span class="n">y_true</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr_theory</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">radius</span><span class="p">)</span>            
+            <span class="n">sum_true</span> <span class="o">+=</span> <span class="n">y_true</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
+            
+        <span class="n">y_true</span> <span class="o">=</span> <span class="n">y_true</span><span class="o">/</span><span class="n">sum_true</span><span class="o">*</span><span class="n">x_range</span><span class="o">/</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
+        
+        <span class="c"># Show the theory P(r)</span>
+        <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y_true</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;P_{true}(r)&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{r}&quot;</span><span class="p">,</span> <span class="s">&#39;A&#39;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{P(r)} &quot;</span><span class="p">,</span><span class="s">&quot;cm^{-3}&quot;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="s">&quot;P_{true}(r)&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="s">&quot;P_{true}(r)&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data_id</span><span class="p">,</span> <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">)</span>
+        <span class="c">#Put this call in plottables/guitools    </span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span>
+                                                <span class="n">title</span><span class="o">=</span><span class="s">&quot;Sphere P(r)&quot;</span><span class="p">))</span>
+       
+        
+    <span class="k">def</span> <span class="nf">get_npts</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.get_npts"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.get_npts">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Returns the number of points in the I(q) data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">return</span> <span class="mi">0</span>
+        
+    <span class="k">def</span> <span class="nf">show_iq</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="n">pr</span><span class="p">,</span> <span class="n">q</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.show_iq"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.show_iq">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>  
+        <span class="n">qtemp</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">x</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">q</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">qtemp</span> <span class="o">=</span> <span class="n">q</span>
+
+        <span class="c"># Make a plot</span>
+        <span class="n">maxq</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
+        <span class="k">for</span> <span class="n">q_i</span> <span class="ow">in</span> <span class="n">qtemp</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">q_i</span><span class="o">&gt;</span><span class="n">maxq</span><span class="p">:</span>
+                <span class="n">maxq</span><span class="o">=</span><span class="n">q_i</span>
+                
+        <span class="n">minq</span> <span class="o">=</span> <span class="mf">0.001</span>
+        
+        <span class="c"># Check for user min/max</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">pr</span><span class="o">.</span><span class="n">q_min</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">minq</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">q_min</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">pr</span><span class="o">.</span><span class="n">q_max</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">maxq</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">q_max</span>
+                
+        <span class="n">x</span> <span class="o">=</span> <span class="n">pylab</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="n">minq</span><span class="p">,</span> <span class="n">maxq</span><span class="p">,</span> <span class="n">maxq</span><span class="o">/</span><span class="mf">301.0</span><span class="p">)</span>
+        <span class="n">y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+        <span class="n">err</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">)):</span>
+            <span class="n">value</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">iq</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+            <span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">err</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">value</span><span class="p">))</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">err</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>
+                <span class="k">print</span> <span class="s">&quot;Error getting error&quot;</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
+                
+        <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">IQ_FIT_LABEL</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{Q}&quot;</span><span class="p">,</span> <span class="s">&#39;A^{-1}&#39;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{Intensity} &quot;</span><span class="p">,</span><span class="s">&quot;cm^{-1}&quot;</span><span class="p">)</span>
+        <span class="n">title</span> <span class="o">=</span> <span class="s">&quot;I(q)&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="n">title</span>
+        
+        <span class="c"># If we have a group ID, use it</span>
+        <span class="k">if</span> <span class="n">pr</span><span class="o">.</span><span class="n">info</span><span class="o">.</span><span class="n">has_key</span><span class="p">(</span><span class="s">&quot;plot_group_id&quot;</span><span class="p">):</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">info</span><span class="p">[</span><span class="s">&quot;plot_group_id&quot;</span><span class="p">]</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="n">IQ_FIT_LABEL</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data_id</span><span class="p">,</span> <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">)</span>
+        
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">))</span>
+        
+        <span class="c"># If we have used slit smearing, plot the smeared I(q) too</span>
+        <span class="k">if</span> <span class="n">pr</span><span class="o">.</span><span class="n">slit_width</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">pr</span><span class="o">.</span><span class="n">slit_height</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">x</span> <span class="o">=</span> <span class="n">pylab</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="n">minq</span><span class="p">,</span> <span class="n">maxq</span><span class="p">,</span> <span class="n">maxq</span><span class="o">/</span><span class="mf">301.0</span><span class="p">)</span>
+            <span class="n">y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+            <span class="n">err</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">)):</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">iq_smeared</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+                <span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">err</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">value</span><span class="p">))</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">err</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="mf">1.0</span>
+                    <span class="k">print</span> <span class="s">&quot;Error getting error&quot;</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
+                    
+            <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">IQ_SMEARED_LABEL</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{Q}&quot;</span><span class="p">,</span> <span class="s">&#39;A^{-1}&#39;</span><span class="p">)</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{Intensity} &quot;</span><span class="p">,</span><span class="s">&quot;cm^{-1}&quot;</span><span class="p">)</span>
+            <span class="c"># If we have a group ID, use it</span>
+            <span class="k">if</span> <span class="n">pr</span><span class="o">.</span><span class="n">info</span><span class="o">.</span><span class="n">has_key</span><span class="p">(</span><span class="s">&quot;plot_group_id&quot;</span><span class="p">):</span>
+              <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">info</span><span class="p">[</span><span class="s">&quot;plot_group_id&quot;</span><span class="p">]</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="n">IQ_SMEARED_LABEL</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="n">title</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data_id</span><span class="p">,</span> <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">)</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="n">title</span><span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">_on_pr_npts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span></div>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Redisplay P(r) with a different number of points</span>
+<span class="sd">        &quot;&quot;&quot;</span>   
+        <span class="kn">from</span> <span class="nn">inversion_panel</span> <span class="kn">import</span> <span class="n">PrDistDialog</span>
+        <span class="n">dialog</span> <span class="o">=</span> <span class="n">PrDistDialog</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        <span class="n">dialog</span><span class="o">.</span><span class="n">set_content</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_pr_npts</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">dialog</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_pr_npts</span><span class="o">=</span> <span class="n">dialog</span><span class="o">.</span><span class="n">get_content</span><span class="p">()</span>
+            <span class="n">dialog</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">show_pr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_last_out</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_pr</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_cov</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">dialog</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+        
+        
+    <span class="k">def</span> <span class="nf">show_pr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="n">pr</span><span class="p">,</span> <span class="n">cov</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
+<div class="viewcode-block" id="Plugin.show_pr"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.show_pr">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>     
+        <span class="c"># Show P(r)</span>
+        <span class="n">x</span> <span class="o">=</span> <span class="n">pylab</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">pr</span><span class="o">.</span><span class="n">d_max</span><span class="p">,</span> <span class="n">pr</span><span class="o">.</span><span class="n">d_max</span><span class="o">/</span><span class="bp">self</span><span class="o">.</span><span class="n">_pr_npts</span><span class="p">)</span>
+    
+        <span class="n">y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+        <span class="n">dy</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+        <span class="n">y_true</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
+
+        <span class="nb">sum</span> <span class="o">=</span> <span class="mf">0.0</span>
+        <span class="n">pmax</span> <span class="o">=</span> <span class="mf">0.0</span>
+        <span class="n">cov2</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ascontiguousarray</span><span class="p">(</span><span class="n">cov</span><span class="p">)</span>
+        
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">)):</span>
+            <span class="k">if</span> <span class="n">cov2</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+                <span class="n">value</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">pr</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">dy</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">pr_err</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">cov2</span><span class="p">,</span> <span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+            <span class="nb">sum</span> <span class="o">+=</span> <span class="n">value</span><span class="o">*</span><span class="n">pr</span><span class="o">.</span><span class="n">d_max</span><span class="o">/</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
+            
+            <span class="c"># keep track of the maximum P(r) value</span>
+            <span class="k">if</span> <span class="n">value</span><span class="o">&gt;</span><span class="n">pmax</span><span class="p">:</span>
+                <span class="n">pmax</span> <span class="o">=</span> <span class="n">value</span>
+                
+            <span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
+                
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_normalize_output</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
+            <span class="n">y</span> <span class="o">=</span> <span class="n">y</span><span class="o">/</span><span class="nb">sum</span>
+            <span class="n">dy</span> <span class="o">=</span> <span class="n">dy</span><span class="o">/</span><span class="nb">sum</span>
+        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scale_output_unity</span><span class="o">==</span><span class="bp">True</span><span class="p">:</span>
+            <span class="n">y</span> <span class="o">=</span> <span class="n">y</span><span class="o">/</span><span class="n">pmax</span>
+            <span class="n">dy</span> <span class="o">=</span> <span class="n">dy</span><span class="o">/</span><span class="n">pmax</span>
+        
+        <span class="k">if</span> <span class="n">cov2</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+            <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">dy</span><span class="o">=</span><span class="n">dy</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">PR_FIT_LABEL</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{r}&quot;</span><span class="p">,</span> <span class="s">&#39;A&#39;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{P(r)} &quot;</span><span class="p">,</span><span class="s">&quot;cm^{-3}&quot;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="s">&quot;P(r) fit&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="n">PR_FIT_LABEL</span>
+        <span class="c"># Make sure that the plot is linear</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xtransform</span> <span class="o">=</span> <span class="s">&quot;x&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">ytransform</span> <span class="o">=</span> <span class="s">&quot;y&quot;</span>  
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">GROUP_ID_PR_FIT</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data_id</span><span class="p">,</span> <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">)</span>    
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;P(r) fit&quot;</span><span class="p">))</span>
+        <span class="k">return</span> <span class="n">x</span><span class="p">,</span> <span class="n">pr</span><span class="o">.</span><span class="n">d_max</span>
+          
+    <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.load"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.load">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Load data. This will eventually be replaced</span>
+<span class="sd">        by our standard DataLoader class.</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">class</span> <span class="nc">FileData</span><span class="p">:</span>
+            <span class="n">x</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">y</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">err</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+            
+            <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">path</span> <span class="o">=</span> <span class="n">path</span>
+                
+        <span class="bp">self</span><span class="o">.</span><span class="n">_current_file_data</span> <span class="o">=</span> <span class="n">FileData</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
+        
+        <span class="c"># Use data loader to load file</span>
+        <span class="c">#dataread = Loader().load(path)</span>
+        <span class="n">dataread</span> <span class="o">=</span> <span class="n">data</span>
+        <span class="c"># Notify the user if we could not read the file</span>
+        <span class="k">if</span> <span class="n">dataread</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="s">&quot;Invalid data&quot;</span>
+            
+        <span class="n">x</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">y</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">err</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="k">if</span> <span class="n">dataread</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;Data1D&#39;</span><span class="p">:</span>
+            <span class="n">x</span> <span class="o">=</span> <span class="n">dataread</span><span class="o">.</span><span class="n">x</span>
+            <span class="n">y</span> <span class="o">=</span> <span class="n">dataread</span><span class="o">.</span><span class="n">y</span>
+            <span class="n">err</span> <span class="o">=</span> <span class="n">dataread</span><span class="o">.</span><span class="n">dy</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dataread</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">dataread</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
+                <span class="n">x</span> <span class="o">=</span> <span class="n">dataread</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">x</span>
+                <span class="n">y</span> <span class="o">=</span> <span class="n">dataread</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">y</span>
+                <span class="n">err</span> <span class="o">=</span> <span class="n">dataread</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">dy</span>
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;PrView only allows a single data set at a time. &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Only the first data set was loaded.&quot;</span> 
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">dataread</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                    <span class="k">return</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">err</span>
+                <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="s">&quot;This tool can only read 1D data&quot;</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_current_file_data</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">x</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_current_file_data</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">y</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_current_file_data</span><span class="o">.</span><span class="n">err</span> <span class="o">=</span> <span class="n">err</span>
+        <span class="k">return</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">err</span>
+                
+    <span class="k">def</span> <span class="nf">load_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span> <span class="o">=</span> <span class="s">&quot;sphere_60_q0_2.txt&quot;</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.load_columns"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.load_columns">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Load 2- or 3- column ascii</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Read the data from the data file</span>
+        <span class="n">data_x</span>   <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="n">data_y</span>   <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="n">data_err</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="n">scale</span>    <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">min_err</span>  <span class="o">=</span> <span class="mf">0.0</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">path</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">input_f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">path</span><span class="p">,</span><span class="s">&#39;r&#39;</span><span class="p">)</span>
+            <span class="n">buff</span>    <span class="o">=</span> <span class="n">input_f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+            <span class="n">lines</span>   <span class="o">=</span> <span class="n">buff</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
+            <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">toks</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
+                    <span class="n">x</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+                    <span class="n">y</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">toks</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                    <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">toks</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">2</span><span class="p">:</span>
+                        <span class="n">err</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">toks</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="k">if</span> <span class="n">scale</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+                            <span class="n">scale</span> <span class="o">=</span> <span class="mf">0.05</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">y</span><span class="p">)</span>
+                            <span class="c">#scale = 0.05/math.sqrt(y)</span>
+                            <span class="n">min_err</span> <span class="o">=</span> <span class="mf">0.01</span><span class="o">*</span><span class="n">y</span>
+                        <span class="n">err</span> <span class="o">=</span> <span class="n">scale</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">+</span><span class="n">min_err</span>
+                        <span class="c">#err = 0</span>
+                        
+                    <span class="n">data_x</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data_x</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
+                    <span class="n">data_y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data_y</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
+                    <span class="n">data_err</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data_err</span><span class="p">,</span> <span class="n">err</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="k">pass</span>
+                   
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">scale</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+            <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;The loaded file had no error bars, statistical errors are assumed.&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
+                        
+        <span class="k">return</span> <span class="n">data_x</span><span class="p">,</span> <span class="n">data_y</span><span class="p">,</span> <span class="n">data_err</span>     
+        
+    <span class="k">def</span> <span class="nf">load_abs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.load_abs"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.load_abs">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Load an IGOR .ABS reduced file</span>
+<span class="sd">        </span>
+<span class="sd">        :param path: file path</span>
+<span class="sd">        </span>
+<span class="sd">        :return: x, y, err vectors</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Read the data from the data file</span>
+        <span class="n">data_x</span>   <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="n">data_y</span>   <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="n">data_err</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
+        <span class="n">scale</span>    <span class="o">=</span> <span class="bp">None</span>
+        <span class="n">min_err</span>  <span class="o">=</span> <span class="mf">0.0</span>
+        
+        <span class="n">data_started</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">path</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">input_f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">path</span><span class="p">,</span><span class="s">&#39;r&#39;</span><span class="p">)</span>
+            <span class="n">buff</span>    <span class="o">=</span> <span class="n">input_f</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
+            <span class="n">lines</span>   <span class="o">=</span> <span class="n">buff</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
+            <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">data_started</span> <span class="o">==</span> <span class="bp">True</span><span class="p">:</span>
+                    <span class="k">try</span><span class="p">:</span>
+                        <span class="n">toks</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
+                        <span class="n">x</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">toks</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+                        <span class="n">y</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">toks</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">toks</span><span class="p">)</span><span class="o">&gt;</span><span class="mi">2</span><span class="p">:</span>
+                            <span class="n">err</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">toks</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="k">if</span> <span class="n">scale</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                                <span class="n">scale</span> <span class="o">=</span> <span class="mf">0.05</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">y</span><span class="p">)</span>
+                                <span class="c">#scale = 0.05/math.sqrt(y)</span>
+                                <span class="n">min_err</span> <span class="o">=</span> <span class="mf">0.01</span><span class="o">*</span><span class="n">y</span>
+                            <span class="n">err</span> <span class="o">=</span> <span class="n">scale</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">y</span><span class="p">)</span><span class="o">+</span><span class="n">min_err</span>
+                            <span class="c">#err = 0</span>
+                            
+                        <span class="n">data_x</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data_x</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
+                        <span class="n">data_y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data_y</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
+                        <span class="n">data_err</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data_err</span><span class="p">,</span> <span class="n">err</span><span class="p">)</span>
+                    <span class="k">except</span><span class="p">:</span>
+                        <span class="k">pass</span>
+                <span class="k">elif</span> <span class="n">line</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s">&quot;The 6 columns&quot;</span><span class="p">)</span><span class="o">&gt;=</span><span class="mi">0</span><span class="p">:</span>
+                    <span class="n">data_started</span> <span class="o">=</span> <span class="bp">True</span>      
+                   
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">scale</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;The loaded file had no error bars, statistical errors are assumed.&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
+                        
+        <span class="k">return</span> <span class="n">data_x</span><span class="p">,</span> <span class="n">data_y</span><span class="p">,</span> <span class="n">data_err</span>     
+        
+    <span class="k">def</span> <span class="nf">pr_theory</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">r</span><span class="p">,</span> <span class="n">R</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.pr_theory"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.pr_theory">[docs]</a>        <span class="sd">&quot;&quot;&quot;  </span>
+<span class="sd">            Return P(r) of a sphere for a given R </span>
+<span class="sd">            For test purposes</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">r</span> <span class="o">&lt;=</span> <span class="mi">2</span><span class="o">*</span><span class="n">R</span><span class="p">:</span>
+            <span class="k">return</span> <span class="mf">12.0</span><span class="o">*</span> <span class="p">((</span><span class="mf">0.5</span><span class="o">*</span><span class="n">r</span><span class="o">/</span><span class="n">R</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span> <span class="o">*</span> <span class="p">((</span><span class="mf">1.0</span><span class="o">-</span><span class="mf">0.5</span><span class="o">*</span><span class="n">r</span><span class="o">/</span><span class="n">R</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span> <span class="mf">2.0</span> <span class="o">+</span> <span class="mf">0.5</span><span class="o">*</span><span class="n">r</span><span class="o">/</span><span class="n">R</span> <span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">return</span> <span class="mf">0.0</span>
+
+    <span class="k">def</span> <span class="nf">get_context_menu</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">plotpanel</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.get_context_menu"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.get_context_menu">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Get the context menu items available for P(r)</span>
+<span class="sd">        </span>
+<span class="sd">        :param graph: the Graph object to which we attach the context menu</span>
+<span class="sd">        </span>
+<span class="sd">        :return: a list of menu items with call-back function</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">graph</span> <span class="o">=</span> <span class="n">plotpanel</span><span class="o">.</span><span class="n">graph</span>
+        <span class="c"># Look whether this Graph contains P(r) data</span>
+        <span class="k">if</span> <span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">plotpanel</span><span class="o">.</span><span class="n">plots</span><span class="p">:</span>
+            <span class="k">return</span> <span class="p">[]</span>
+        <span class="n">item</span> <span class="o">=</span> <span class="n">plotpanel</span><span class="o">.</span><span class="n">plots</span><span class="p">[</span><span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span><span class="p">]</span>
+        <span class="k">if</span> <span class="n">item</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">PR_FIT_LABEL</span><span class="p">:</span>
+            <span class="c">#add_data_hint = &quot;Load a data file and display it on this plot&quot;</span>
+            <span class="c">#[&quot;Add P(r) data&quot;,add_data_hint , self._on_add_data],</span>
+            <span class="n">change_n_hint</span> <span class="o">=</span> <span class="s">&quot;Change the number of&quot;</span>
+            <span class="n">change_n_hint</span> <span class="o">+=</span> <span class="s">&quot; points on the P(r) output&quot;</span>
+            <span class="n">change_n_label</span> <span class="o">=</span> <span class="s">&quot;Change number of P(r) points&quot;</span>
+            <span class="n">m_list</span> <span class="o">=</span> <span class="p">[[</span><span class="n">change_n_label</span><span class="p">,</span> <span class="n">change_n_hint</span> <span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_pr_npts</span><span class="p">]]</span>
+
+            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scale_output_unity</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_normalize_output</span><span class="p">:</span>
+                <span class="n">hint</span> <span class="o">=</span> <span class="s">&quot;Let the output P(r) keep the scale of the data&quot;</span>
+                <span class="n">m_list</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&quot;Disable P(r) scaling&quot;</span><span class="p">,</span> <span class="n">hint</span><span class="p">,</span> 
+                               <span class="bp">self</span><span class="o">.</span><span class="n">_on_disable_scaling</span><span class="p">])</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scale_output_unity</span><span class="p">:</span>
+                <span class="n">m_list</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&quot;Scale P_max(r) to unity&quot;</span><span class="p">,</span> 
+                               <span class="s">&quot;Scale P(r) so that its maximum is 1&quot;</span><span class="p">,</span> 
+                               <span class="bp">self</span><span class="o">.</span><span class="n">_on_scale_unity</span><span class="p">])</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_normalize_output</span><span class="p">:</span>
+                <span class="n">m_list</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="s">&quot;Normalize P(r) to unity&quot;</span><span class="p">,</span> 
+                               <span class="s">&quot;Normalize the integral of P(r) to 1&quot;</span><span class="p">,</span> 
+                               <span class="bp">self</span><span class="o">.</span><span class="n">_on_normalize</span><span class="p">])</span>
+                
+            <span class="k">return</span> <span class="n">m_list</span>
+             
+        <span class="k">elif</span> <span class="n">item</span><span class="o">.</span><span class="n">id</span> <span class="ow">in</span> <span class="p">[</span><span class="n">PR_LOADED_LABEL</span><span class="p">,</span> <span class="n">IQ_DATA_LABEL</span><span class="p">,</span> <span class="n">IQ_FIT_LABEL</span><span class="p">,</span>
+                          <span class="n">IQ_SMEARED_LABEL</span><span class="p">]:</span>
+            <span class="k">return</span> <span class="p">[]</span>
+        <span class="k">elif</span> <span class="n">item</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span><span class="p">:</span>
+           <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">standalone</span> <span class="ow">and</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">):</span>
+                <span class="k">return</span> <span class="p">[[</span><span class="s">&quot;Compute P(r)&quot;</span><span class="p">,</span> 
+                             <span class="s">&quot;Compute P(r) from distribution&quot;</span><span class="p">,</span> 
+                             <span class="bp">self</span><span class="o">.</span><span class="n">_on_context_inversion</span><span class="p">]]</span>      
+                
+        <span class="k">return</span> <span class="p">[]</span>
+
+    <span class="k">def</span> <span class="nf">_on_disable_scaling</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span></div>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Disable P(r) scaling</span>
+<span class="sd">            </span>
+<span class="sd">        :param evt: Menu event</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_normalize_output</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_scale_output_unity</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_pr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_last_out</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_pr</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_cov</span><span class="p">)</span>
+        
+        <span class="c"># Now replot the original added data</span>
+        <span class="k">for</span> <span class="n">plot</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_default_Iq</span><span class="p">[</span><span class="n">plot</span><span class="p">])</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                         <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">],</span> 
+                                      <span class="n">title</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">,</span>
+                                                   <span class="n">update</span><span class="o">=</span><span class="bp">True</span><span class="p">))</span>        
+        
+        <span class="c"># Need the update flag in the NewPlotEvent to protect against</span>
+        <span class="c"># the plot no longer being there...</span>
+        
+    <span class="k">def</span> <span class="nf">_on_normalize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Normalize the area under the P(r) curve to 1.</span>
+<span class="sd">        This operation is done for all displayed plots.</span>
+<span class="sd">        </span>
+<span class="sd">        :param evt: Menu event</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_normalize_output</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_scale_output_unity</span> <span class="o">=</span> <span class="bp">False</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_pr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_last_out</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_pr</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_cov</span><span class="p">)</span>
+        
+        <span class="c"># Now scale the added plots too</span>
+        <span class="k">for</span> <span class="n">plot</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">:</span>
+            <span class="nb">sum</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">y</span><span class="p">)</span>
+            <span class="n">npts</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+            <span class="nb">sum</span> <span class="o">*=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">x</span><span class="p">[</span><span class="n">npts</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">/</span><span class="n">npts</span>
+            <span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">y</span><span class="o">/</span><span class="nb">sum</span>
+            
+            <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">group_id</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">id</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">title</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">name</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{r}&quot;</span><span class="p">,</span> <span class="s">&#39;A&#39;</span><span class="p">)</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{P(r)} &quot;</span><span class="p">,</span><span class="s">&quot;cm^{-3}&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data_id</span><span class="p">,</span> <span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">)</span>        
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                         <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+                                         <span class="n">title</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>
+        
+    <span class="k">def</span> <span class="nf">_on_scale_unity</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">evt</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Scale the maximum P(r) value on each displayed plot to 1.</span>
+<span class="sd">        </span>
+<span class="sd">        :param evt: Menu event</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_scale_output_unity</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_normalize_output</span> <span class="o">=</span> <span class="bp">False</span>
+            
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_pr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_last_out</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_pr</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_cov</span><span class="p">)</span>
+        
+        <span class="c"># Now scale the added plots too</span>
+        <span class="k">for</span> <span class="n">plot</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">:</span>
+            <span class="n">_max</span> <span class="o">=</span> <span class="mi">0</span>
+            <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">y</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">y</span><span class="o">&gt;</span><span class="n">_max</span><span class="p">:</span> 
+                    <span class="n">_max</span> <span class="o">=</span> <span class="n">y</span>
+            <span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">y</span><span class="o">/</span><span class="n">_max</span>
+            
+            <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">name</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{r}&quot;</span><span class="p">,</span> <span class="s">&#39;A&#39;</span><span class="p">)</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{P(r)} &quot;</span><span class="p">,</span><span class="s">&quot;cm^{-3}&quot;</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">update_theory</span><span class="p">(</span><span class="n">data_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data_id</span><span class="p">,</span><span class="n">theory</span><span class="o">=</span><span class="n">new_plot</span><span class="p">)</span>        
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                         <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
+                                <span class="n">title</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_added_plots</span><span class="p">[</span><span class="n">plot</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">))</span>        
+                
+    <span class="k">def</span> <span class="nf">start_thread</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="Plugin.start_thread"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.start_thread">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">pr_thread</span> <span class="kn">import</span> <span class="n">CalcPr</span>
+        
+        <span class="c"># If a thread is already started, stop it</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">calc_thread</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">calc_thread</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">calc_thread</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
+            <span class="c">## stop just raises the flag -- the thread is supposed to </span>
+            <span class="c">## then kill itself. In August 2014 it was shown that this is</span>
+            <span class="c">## incorrectly handled by fitting.py and a fix implemented. </span>
+            <span class="c">## It is not clear whether it is properly used here, but the</span>
+            <span class="c">## &quot;fix&quot; of waiting for the previous thread to end breaks the</span>
+            <span class="c">## pr perspective completely as it causes an infinite loop.</span>
+            <span class="c">## Thus it is likely the threading is bing properly handled.</span>
+            <span class="c">## While the &quot;fix&quot; is no longer implemented the comment is</span>
+            <span class="c">## left here till somebody ascertains that in fact the threads</span>
+            <span class="c">## are being properly handled.</span>
+            <span class="c">##</span>
+            <span class="c">##    -PDB January 25, 2015                  </span>
+                
+        <span class="n">pr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">calc_thread</span> <span class="o">=</span> <span class="n">CalcPr</span><span class="p">(</span><span class="n">pr</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">,</span>
+                                   <span class="n">error_func</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_thread_error</span><span class="p">,</span> 
+                                   <span class="n">completefn</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_completed</span><span class="p">,</span> <span class="n">updatefn</span><span class="o">=</span><span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">calc_thread</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">calc_thread</span><span class="o">.</span><span class="n">ready</span><span class="p">(</span><span class="mf">2.5</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">_thread_error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">error</span><span class="p">):</span></div>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">error</span><span class="p">))</span>
+    
+    <span class="k">def</span> <span class="nf">_estimate_completed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="n">message</span><span class="p">,</span> <span class="n">elapsed</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Parameter estimation completed, </span>
+<span class="sd">        display the results to the user</span>
+<span class="sd">        </span>
+<span class="sd">        :param alpha: estimated best alpha</span>
+<span class="sd">        :param elapsed: computation time</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Save useful info</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">elapsed</span> <span class="o">=</span> <span class="n">elapsed</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">alpha_estimate</span> <span class="o">=</span> <span class="n">alpha</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">message</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">message</span><span class="p">)))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">perform_estimateNT</span><span class="p">()</span>
+    
+    <span class="k">def</span> <span class="nf">_estimateNT_completed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">nterms</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="n">message</span><span class="p">,</span> <span class="n">elapsed</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Parameter estimation completed, </span>
+<span class="sd">        display the results to the user</span>
+<span class="sd">        </span>
+<span class="sd">        :param alpha: estimated best alpha</span>
+<span class="sd">        :param nterms: estimated number of terms</span>
+<span class="sd">        :param elapsed: computation time</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Save useful info</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">elapsed</span> <span class="o">=</span> <span class="n">elapsed</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">nterms_estimate</span> <span class="o">=</span> <span class="n">nterms</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">alpha_estimate</span> <span class="o">=</span> <span class="n">alpha</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="n">message</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">message</span><span class="p">)))</span>
+    
+    <span class="k">def</span> <span class="nf">_completed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="n">cov</span><span class="p">,</span> <span class="n">pr</span><span class="p">,</span> <span class="n">elapsed</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        wxCallAfter Method called with the results when the inversion</span>
+<span class="sd">        is done</span>
+<span class="sd">        </span>
+<span class="sd">        :param out: output coefficient for the base functions</span>
+<span class="sd">        :param cov: covariance matrix</span>
+<span class="sd">        :param pr: Invertor instance</span>
+<span class="sd">        :param elapsed: time spent computing</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Ensure hat you have all inputs are ready at the time call happens:</span>
+        <span class="c"># Without CallAfter, it will freeze with wx &gt;= 2.9.</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">CallAfter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_completed_call</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="n">cov</span><span class="p">,</span> <span class="n">pr</span><span class="p">,</span> <span class="n">elapsed</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_completed_call</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">out</span><span class="p">,</span> <span class="n">cov</span><span class="p">,</span> <span class="n">pr</span><span class="p">,</span> <span class="n">elapsed</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Method called with the results when the inversion</span>
+<span class="sd">        is done</span>
+<span class="sd">        </span>
+<span class="sd">        :param out: output coefficient for the base functions</span>
+<span class="sd">        :param cov: covariance matrix</span>
+<span class="sd">        :param pr: Invertor instance</span>
+<span class="sd">        :param elapsed: time spent computing</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Save useful info</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">elapsed</span> <span class="o">=</span> <span class="n">elapsed</span>
+        <span class="c"># Keep a copy of the last result</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_last_pr</span>  <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_last_out</span> <span class="o">=</span> <span class="n">out</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_last_cov</span> <span class="o">=</span> <span class="n">cov</span>
+        
+        <span class="c"># Save Pr invertor</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pr</span> <span class="o">=</span> <span class="n">pr</span>
+        
+        <span class="c">#message = &quot;Computation completed in&quot;</span>
+        <span class="c">#message +=  %g seconds [chi2=%g]&quot; % (elapsed, pr.chi2)</span>
+        <span class="c">#wx.PostEvent(self.parent, StatusEvent(status=message))</span>
+
+        <span class="n">cov</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ascontiguousarray</span><span class="p">(</span><span class="n">cov</span><span class="p">)</span>
+
+        <span class="c"># Show result on control panel</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">chi2</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">chi2</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">elapsed</span> <span class="o">=</span> <span class="n">elapsed</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">oscillation</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">oscillations</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">positive</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">get_positive</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">pos_err</span>  <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">get_pos_err</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">cov</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">rg</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">rg</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">iq0</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">iq0</span><span class="p">(</span><span class="n">out</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">bck</span> <span class="o">=</span> <span class="n">pr</span><span class="o">.</span><span class="n">background</span>
+                        
+        <span class="c"># Show I(q) fit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_iq</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="p">)</span>
+        
+        <span class="c"># Show P(r) fit</span>
+        <span class="n">x_values</span><span class="p">,</span> <span class="n">x_range</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">show_pr</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="p">,</span> <span class="n">cov</span><span class="p">)</span>  
+                
+    <span class="k">def</span> <span class="nf">show_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">reset</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
+<div class="viewcode-block" id="Plugin.show_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.show_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Show data read from a file</span>
+<span class="sd">        </span>
+<span class="sd">        :param path: file path</span>
+<span class="sd">        :param reset: if True all other plottables will be cleared</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#if path is not None:</span>
+        <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="n">pr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_create_file_pr</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            <span class="k">except</span><span class="p">:</span>
+                <span class="n">status</span> <span class="o">=</span> <span class="s">&quot;Problem reading data: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">status</span><span class="p">))</span>
+                <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">status</span>
+                
+            <span class="c"># If the file contains nothing, just return</span>
+            <span class="k">if</span> <span class="n">pr</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="s">&quot;Loaded data is invalid&quot;</span>
+            
+            <span class="bp">self</span><span class="o">.</span><span class="n">pr</span> <span class="o">=</span> <span class="n">pr</span>
+       
+        <span class="c"># Make a plot of I(q) data</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">err</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">y</span><span class="p">)</span>
+            <span class="n">new_plot</span><span class="o">.</span><span class="n">symbol</span> <span class="o">=</span> <span class="n">GUIFRAME_ID</span><span class="o">.</span><span class="n">CURVE_SYMBOL_NUM</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">y</span><span class="p">,</span> <span class="n">dy</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">err</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">IQ_DATA_LABEL</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{Q}&quot;</span><span class="p">,</span> <span class="s">&#39;A^{-1}&#39;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{Intensity} &quot;</span><span class="p">,</span><span class="s">&quot;cm^{-1}&quot;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">interactive</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">group_id</span> <span class="o">=</span> <span class="n">GROUP_ID_IQ_DATA</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_id</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="s">&quot;I(q)&quot;</span>   
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                     <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;I(q)&quot;</span><span class="p">,</span> <span class="n">reset</span><span class="o">=</span><span class="n">reset</span><span class="p">))</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span> <span class="o">=</span> <span class="n">new_plot</span>
+        <span class="c"># Get Q range</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">q_min</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">q_max</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">x</span><span class="p">)</span>
+            
+    <span class="k">def</span> <span class="nf">save_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filepath</span><span class="p">,</span> <span class="n">prstate</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.save_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.save_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Save data in provided state object.</span>
+<span class="sd">        </span>
+<span class="sd">        :TODO: move the state code away from inversion_panel and move it here. </span>
+<span class="sd">                Then remove the &quot;prstate&quot; input and make this method private.</span>
+<span class="sd">                </span>
+<span class="sd">        :param filepath: path of file to write to</span>
+<span class="sd">        :param prstate: P(r) inversion state </span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#TODO: do we need this or can we use DataLoader.loader.save directly?</span>
+        
+        <span class="c"># Add output data and coefficients to state</span>
+        <span class="n">prstate</span><span class="o">.</span><span class="n">coefficients</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_out</span>
+        <span class="n">prstate</span><span class="o">.</span><span class="n">covariance</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_last_cov</span>
+        
+        <span class="c"># Write the output to file</span>
+        <span class="c"># First, check that the data is of the right type</span>
+        <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span>
+                       <span class="n">sas</span><span class="o">.</span><span class="n">dataloader</span><span class="o">.</span><span class="n">data_info</span><span class="o">.</span><span class="n">Data1D</span><span class="p">):</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">state_reader</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">filepath</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="p">,</span> <span class="n">prstate</span><span class="p">)</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;pr.save_data: the data being saved is not a&quot;</span>
+            <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot; sas.data_info.Data1D object&quot;</span> 
+            <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">msg</span>
+        
+        
+    <span class="k">def</span> <span class="nf">setup_plot_inversion</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="n">nfunc</span><span class="p">,</span> <span class="n">d_max</span><span class="p">,</span> <span class="n">q_min</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">q_max</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> </div>
+<div class="viewcode-block" id="Plugin.setup_plot_inversion"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.setup_plot_inversion">[docs]</a>                             <span class="n">bck</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">height</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="n">alpha</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="n">nfunc</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">max_length</span> <span class="o">=</span> <span class="n">d_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">q_min</span> <span class="o">=</span> <span class="n">q_min</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">q_max</span> <span class="o">=</span> <span class="n">q_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">has_bck</span> <span class="o">=</span> <span class="n">bck</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_height</span> <span class="o">=</span> <span class="n">height</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_width</span>  <span class="o">=</span> <span class="n">width</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">pr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_create_plot_pr</span><span class="p">()</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">pr</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">pr</span> <span class="o">=</span> <span class="n">pr</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">perform_inversion</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">))</span>
+
+    <span class="k">def</span> <span class="nf">estimate_plot_inversion</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="n">nfunc</span><span class="p">,</span> <span class="n">d_max</span><span class="p">,</span> </div>
+<div class="viewcode-block" id="Plugin.estimate_plot_inversion"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.estimate_plot_inversion">[docs]</a>                                <span class="n">q_min</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">q_max</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                                <span class="n">bck</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">height</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="n">alpha</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="n">nfunc</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">max_length</span> <span class="o">=</span> <span class="n">d_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">q_min</span> <span class="o">=</span> <span class="n">q_min</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">q_max</span> <span class="o">=</span> <span class="n">q_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">has_bck</span> <span class="o">=</span> <span class="n">bck</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_height</span> <span class="o">=</span> <span class="n">height</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_width</span>  <span class="o">=</span> <span class="n">width</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">pr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_create_plot_pr</span><span class="p">()</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">pr</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">pr</span> <span class="o">=</span> <span class="n">pr</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">perform_estimate</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">))</span>            
+
+    <span class="k">def</span> <span class="nf">_create_plot_pr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">estimate</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span></div>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create and prepare invertor instance from</span>
+<span class="sd">        a plottable data set.</span>
+<span class="sd">        </span>
+<span class="sd">        :param path: path of the file to read in </span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Sanity check</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Please load a valid data set before proceeding.&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">))</span>  
+            <span class="k">return</span> <span class="bp">None</span>   
+        
+        <span class="c"># Get the data from the chosen data set and perform inversion</span>
+        <span class="n">pr</span> <span class="o">=</span> <span class="n">Invertor</span><span class="p">()</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">d_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_length</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">q_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">q_min</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">q_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">q_max</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="o">.</span><span class="n">x</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="o">.</span><span class="n">y</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">has_bck</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">has_bck</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">slit_height</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_height</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">slit_width</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_width</span>
+        
+        <span class="c"># Keep track of the plot window title to ensure that</span>
+        <span class="c"># we can overlay the plots</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">info</span><span class="p">[</span><span class="s">&quot;plot_group_id&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="o">.</span><span class="n">group_id</span>
+        
+        <span class="c"># Fill in errors if none were provided</span>
+        <span class="n">err</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="o">.</span><span class="n">dy</span>
+        <span class="n">all_zeros</span> <span class="o">=</span> <span class="bp">True</span>
+        <span class="k">if</span> <span class="n">err</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">err</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">pr</span><span class="o">.</span><span class="n">y</span><span class="p">))</span> 
+        <span class="k">else</span><span class="p">:</span>    
+            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">err</span><span class="p">)):</span>
+                <span class="k">if</span> <span class="n">err</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span>
+                    <span class="n">all_zeros</span> <span class="o">=</span> <span class="bp">False</span>
+        
+        <span class="k">if</span> <span class="n">all_zeros</span><span class="p">:</span>        
+            <span class="n">scale</span> <span class="o">=</span> <span class="bp">None</span>
+            <span class="n">min_err</span> <span class="o">=</span> <span class="mf">0.0</span>
+            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">pr</span><span class="o">.</span><span class="n">y</span><span class="p">)):</span>
+                <span class="c"># Scale the error so that we can fit over several decades of Q</span>
+                <span class="k">if</span> <span class="n">scale</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+                    <span class="n">scale</span> <span class="o">=</span> <span class="mf">0.05</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">pr</span><span class="o">.</span><span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+                    <span class="n">min_err</span> <span class="o">=</span> <span class="mf">0.01</span><span class="o">*</span><span class="n">pr</span><span class="o">.</span><span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
+                <span class="n">err</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">scale</span><span class="o">*</span><span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span> <span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">pr</span><span class="o">.</span><span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="p">)</span> <span class="o">+</span> <span class="n">min_err</span>
+            <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;The loaded file had no error bars, &quot;</span>
+            <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;statistical errors are assumed.&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="p">))</span>
+
+        <span class="n">pr</span><span class="o">.</span><span class="n">err</span> <span class="o">=</span> <span class="n">err</span>
+        
+        <span class="k">return</span> <span class="n">pr</span>
+
+          
+    <span class="k">def</span> <span class="nf">setup_file_inversion</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="n">nfunc</span><span class="p">,</span> <span class="n">d_max</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span>
+<div class="viewcode-block" id="Plugin.setup_file_inversion"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.setup_file_inversion">[docs]</a>                             <span class="n">path</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">q_min</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">q_max</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                             <span class="n">bck</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">height</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="n">alpha</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="n">nfunc</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">max_length</span> <span class="o">=</span> <span class="n">d_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">q_min</span> <span class="o">=</span> <span class="n">q_min</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">q_max</span> <span class="o">=</span> <span class="n">q_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">has_bck</span> <span class="o">=</span> <span class="n">bck</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_height</span> <span class="o">=</span> <span class="n">height</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_width</span>  <span class="o">=</span> <span class="n">width</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c">#pr = self._create_file_pr(path)</span>
+            <span class="n">pr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_create_file_pr</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">pr</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">pr</span> <span class="o">=</span> <span class="n">pr</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">perform_inversion</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">))</span>
+          
+    <span class="k">def</span> <span class="nf">estimate_file_inversion</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="n">nfunc</span><span class="p">,</span> <span class="n">d_max</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span></div>
+<div class="viewcode-block" id="Plugin.estimate_file_inversion"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.estimate_file_inversion">[docs]</a>                                <span class="n">path</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">q_min</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">q_max</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> 
+                                <span class="n">bck</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">height</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="n">alpha</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="n">nfunc</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">max_length</span> <span class="o">=</span> <span class="n">d_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">q_min</span> <span class="o">=</span> <span class="n">q_min</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">q_max</span> <span class="o">=</span> <span class="n">q_max</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">has_bck</span> <span class="o">=</span> <span class="n">bck</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_height</span> <span class="o">=</span> <span class="n">height</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">slit_width</span>  <span class="o">=</span> <span class="n">width</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">pr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_create_file_pr</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+            <span class="c">#pr = self._create_file_pr(path)</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="n">pr</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">pr</span> <span class="o">=</span> <span class="n">pr</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">perform_estimate</span><span class="p">()</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">))</span>
+                
+          
+    <span class="k">def</span> <span class="nf">_create_file_pr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span></div>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Create and prepare invertor instance from</span>
+<span class="sd">        a file data set.</span>
+<span class="sd">        </span>
+<span class="sd">        :param path: path of the file to read in </span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Load data</span>
+        <span class="c">#if os.path.isfile(path):</span>
+        <span class="sd">&quot;&quot;&quot;    </span>
+<span class="sd">        if self._current_file_data is not None \</span>
+<span class="sd">            and self._current_file_data.path==path:</span>
+<span class="sd">            # Protect against corrupted data from </span>
+<span class="sd">            # previous failed load attempt</span>
+<span class="sd">            if self._current_file_data.x is None:</span>
+<span class="sd">                return None</span>
+<span class="sd">            x = self._current_file_data.x</span>
+<span class="sd">            y = self._current_file_data.y</span>
+<span class="sd">            err = self._current_file_data.err</span>
+<span class="sd">            </span>
+<span class="sd">            message = &quot;The data from this file has already been loaded.&quot;</span>
+<span class="sd">            wx.PostEvent(self.parent, StatusEvent(status=message))</span>
+<span class="sd">        else:</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Reset the status bar so that we don&#39;t get mixed up</span>
+        <span class="c"># with old messages. </span>
+        <span class="c">#TODO: refactor this into a proper status handling</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="k">class</span> <span class="nc">FileData</span><span class="p">:</span>
+                <span class="n">x</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">y</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">err</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">path</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">path</span> <span class="o">=</span> <span class="n">path</span>
+                
+            <span class="bp">self</span><span class="o">.</span><span class="n">_current_file_data</span> <span class="o">=</span> <span class="n">FileData</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_current_file_data</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">x</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_current_file_data</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">y</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_current_file_data</span><span class="o">.</span><span class="n">err</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">dy</span>
+            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">err</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="n">data</span><span class="o">.</span><span class="n">y</span><span class="p">,</span> <span class="n">data</span><span class="o">.</span><span class="n">dy</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">load_error</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+            <span class="k">return</span> <span class="bp">None</span>
+        
+        <span class="c"># If the file contains no data, just return</span>
+        <span class="k">if</span> <span class="n">x</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">load_error</span><span class="p">(</span><span class="s">&quot;The loaded file contains no data&quot;</span><span class="p">)</span>
+            <span class="k">return</span> <span class="bp">None</span>
+
+        <span class="c"># If we have not errors, add statistical errors</span>
+        <span class="k">if</span> <span class="n">y</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="k">if</span> <span class="n">err</span> <span class="o">==</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">numpy</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">err</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                <span class="n">err</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">))</span>
+                <span class="n">scale</span> <span class="o">=</span> <span class="bp">None</span>
+                <span class="n">min_err</span> <span class="o">=</span> <span class="mf">0.0</span>
+                <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">)):</span>
+                    <span class="c"># Scale the error so that we can fit over several decades of Q</span>
+                    <span class="k">if</span> <span class="n">scale</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="n">scale</span> <span class="o">=</span> <span class="mf">0.05</span> <span class="o">*</span> <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>
+                        <span class="n">min_err</span> <span class="o">=</span> <span class="mf">0.01</span> <span class="o">*</span> <span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
+                    <span class="n">err</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">scale</span> <span class="o">*</span> <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span> <span class="o">+</span> <span class="n">min_err</span>
+                <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;The loaded file had no error bars, &quot;</span>
+                <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;statistical errors are assumed.&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="p">))</span>
+        
+        <span class="k">try</span><span class="p">:</span>
+            <span class="c"># Get the data from the chosen data set and perform inversion</span>
+            <span class="n">pr</span> <span class="o">=</span> <span class="n">Invertor</span><span class="p">()</span>
+            <span class="n">pr</span><span class="o">.</span><span class="n">d_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_length</span>
+            <span class="n">pr</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span>
+            <span class="n">pr</span><span class="o">.</span><span class="n">q_min</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">q_min</span>
+            <span class="n">pr</span><span class="o">.</span><span class="n">q_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">q_max</span>
+            <span class="n">pr</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">x</span>
+            <span class="n">pr</span><span class="o">.</span><span class="n">y</span> <span class="o">=</span> <span class="n">y</span>
+            <span class="n">pr</span><span class="o">.</span><span class="n">err</span> <span class="o">=</span> <span class="n">err</span>
+            <span class="n">pr</span><span class="o">.</span><span class="n">has_bck</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">has_bck</span>
+            <span class="n">pr</span><span class="o">.</span><span class="n">slit_height</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_height</span>
+            <span class="n">pr</span><span class="o">.</span><span class="n">slit_width</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">slit_width</span>
+            <span class="k">return</span> <span class="n">pr</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="n">load_error</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+        <span class="k">return</span> <span class="bp">None</span>
+        
+    <span class="k">def</span> <span class="nf">perform_estimate</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="Plugin.perform_estimate"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.perform_estimate">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">pr_thread</span> <span class="kn">import</span> <span class="n">EstimatePr</span>
+        <span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">deepcopy</span>
+        
+        <span class="c"># If a thread is already started, stop it</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> \
+            <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
+            <span class="c">## stop just raises the flag -- the thread is supposed to </span>
+            <span class="c">## then kill itself. In August 2014 it was shown that this is</span>
+            <span class="c">## incorrectly handled by fitting.py and a fix implemented. </span>
+            <span class="c">## It is not clear whether it is properly used here, but the</span>
+            <span class="c">## &quot;fix&quot; of waiting for the previous thread to end breaks the</span>
+            <span class="c">## pr perspective completely as it causes an infinite loop.</span>
+            <span class="c">## Thus it is likely the threading is bing properly handled.</span>
+            <span class="c">## While the &quot;fix&quot; is no longer implemented the comment is</span>
+            <span class="c">## left here till somebody ascertains that in fact the threads</span>
+            <span class="c">## are being properly handled.</span>
+            <span class="c">##</span>
+            <span class="c">##    -PDB January 25, 2015                  </span>
+                
+                
+        <span class="n">pr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span> <span class="o">=</span> <span class="n">EstimatePr</span><span class="p">(</span><span class="n">pr</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">,</span>
+                                             <span class="n">error_func</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_thread_error</span><span class="p">,</span> 
+                                         <span class="n">completefn</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_estimate_completed</span><span class="p">,</span> 
+                                            <span class="n">updatefn</span>   <span class="o">=</span> <span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span><span class="o">.</span><span class="n">ready</span><span class="p">(</span><span class="mf">2.5</span><span class="p">)</span>
+    
+    <span class="k">def</span> <span class="nf">perform_estimateNT</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.perform_estimateNT"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.perform_estimateNT">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">pr_thread</span> <span class="kn">import</span> <span class="n">EstimateNT</span>
+        <span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">deepcopy</span>
+        
+        <span class="c"># If a thread is already started, stop it</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span> <span class="o">!=</span> <span class="bp">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span><span class="o">.</span><span class="n">isrunning</span><span class="p">():</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
+            <span class="c">## stop just raises the flag -- the thread is supposed to </span>
+            <span class="c">## then kill itself. In August 2014 it was shown that this is</span>
+            <span class="c">## incorrectly handled by fitting.py and a fix implemented. </span>
+            <span class="c">## It is not clear whether it is properly used here, but the</span>
+            <span class="c">## &quot;fix&quot; of waiting for the previous thread to end breaks the</span>
+            <span class="c">## pr perspective completely as it causes an infinite loop.</span>
+            <span class="c">## Thus it is likely the threading is bing properly handled.</span>
+            <span class="c">## While the &quot;fix&quot; is no longer implemented the comment is</span>
+            <span class="c">## left here till somebody ascertains that in fact the threads</span>
+            <span class="c">## are being properly handled.</span>
+            <span class="c">##</span>
+            <span class="c">##    -PDB January 25, 2015                  </span>
+                                
+        <span class="n">pr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">clone</span><span class="p">()</span>
+        <span class="c"># Skip the slit settings for the estimation</span>
+        <span class="c"># It slows down the application and it doesn&#39;t change the estimates</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">slit_height</span> <span class="o">=</span> <span class="mf">0.0</span>
+        <span class="n">pr</span><span class="o">.</span><span class="n">slit_width</span>  <span class="o">=</span> <span class="mf">0.0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span> <span class="o">=</span> <span class="n">EstimateNT</span><span class="p">(</span><span class="n">pr</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">,</span> 
+                                            <span class="n">error_func</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_thread_error</span><span class="p">,</span> 
+                                        <span class="n">completefn</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_estimateNT_completed</span><span class="p">,</span> 
+                                            <span class="n">updatefn</span>   <span class="o">=</span> <span class="bp">None</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span><span class="o">.</span><span class="n">queue</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">estimation_thread</span><span class="o">.</span><span class="n">ready</span><span class="p">(</span><span class="mf">2.5</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">perform_inversion</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.perform_inversion"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.perform_inversion">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Time estimate</span>
+        <span class="c">#estimated = self.elapsed*self.nfunc**2</span>
+        <span class="c">#message = &quot;Computation time may take up to %g seconds&quot; % self.elapsed</span>
+        <span class="c">#wx.PostEvent(self.parent, StatusEvent(status=message))</span>
+        
+        <span class="c"># Start inversion thread</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">start_thread</span><span class="p">()</span>
+        <span class="k">return</span>
+        
+        <span class="n">out</span><span class="p">,</span> <span class="n">cov</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">lstsq</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">)</span>
+        
+        <span class="c"># Save useful info</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">elapsed</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">elapsed</span>
+        
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">out</span><span class="p">)):</span>
+            <span class="k">try</span><span class="p">:</span>
+                <span class="k">print</span> <span class="s">&quot;</span><span class="si">%d</span><span class="s">: </span><span class="si">%g</span><span class="s"> +- </span><span class="si">%g</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">out</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
+                                         <span class="n">math</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">fabs</span><span class="p">(</span><span class="n">cov</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">i</span><span class="p">])))</span>
+            <span class="k">except</span><span class="p">:</span> 
+                <span class="k">print</span> <span class="s">&quot;</span><span class="si">%d</span><span class="s">: </span><span class="si">%g</span><span class="s"> +- ?&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">out</span><span class="p">[</span><span class="n">i</span><span class="p">])</span>        
+        
+        <span class="c"># Make a plot of I(q) data</span>
+        <span class="n">new_plot</span> <span class="o">=</span> <span class="n">Data1D</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">x</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">y</span><span class="p">,</span> <span class="n">dy</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">err</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;I_{obs}(q)&quot;</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">xaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{Q}&quot;</span><span class="p">,</span> <span class="s">&#39;A^{-1}&#39;</span><span class="p">)</span>
+        <span class="n">new_plot</span><span class="o">.</span><span class="n">yaxis</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\\</span><span class="s">rm{Intensity} &quot;</span><span class="p">,</span><span class="s">&quot;cm^{-1}&quot;</span><span class="p">)</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">plot</span><span class="o">=</span><span class="n">new_plot</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s">&quot;Iq&quot;</span><span class="p">))</span>
+        <span class="c"># Show I(q) fit</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">show_iq</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="p">)</span>
+        <span class="c"># Show P(r) fit</span>
+        <span class="n">x_values</span><span class="p">,</span> <span class="n">x_range</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">show_pr</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="p">,</span> <span class="n">cov</span><span class="o">=</span><span class="n">cov</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_on_context_inversion</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span></div>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">panel</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="n">Plugin</span><span class="o">.</span><span class="n">on_perspective</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="o">=</span><span class="n">event</span><span class="p">)</span>
+
+        <span class="c"># If we have more than one displayed plot, make the user choose</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">panel</span><span class="o">.</span><span class="n">plots</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">1</span> <span class="ow">and</span> \
+            <span class="n">panel</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span> <span class="ow">in</span> <span class="n">panel</span><span class="o">.</span><span class="n">plots</span><span class="p">:</span>
+            <span class="n">dataset</span> <span class="o">=</span> <span class="n">panel</span><span class="o">.</span><span class="n">plots</span><span class="p">[</span><span class="n">panel</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span><span class="p">]</span><span class="o">.</span><span class="n">name</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Prview Error: No data is available&quot;</span><span class="p">)</span>
+            <span class="k">return</span>
+        
+        <span class="c"># Store a reference to the current plottable</span>
+        <span class="c"># If we have a suggested value, use it.</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">estimate</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">alpha_estimate</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="n">estimate</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span>
+            <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Prview :Alpha Not estimate yet&quot;</span><span class="p">)</span>
+            <span class="k">pass</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="n">estimate</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">nterms_estimate</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="n">estimate</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span>
+            <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Prview : ntemrs Not estimate yet&quot;</span><span class="p">)</span>
+            <span class="k">pass</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span> <span class="o">=</span> <span class="n">panel</span><span class="o">.</span><span class="n">plots</span><span class="p">[</span><span class="n">panel</span><span class="o">.</span><span class="n">graph</span><span class="o">.</span><span class="n">selected_plottable</span><span class="p">]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">set_data</span><span class="p">([</span><span class="bp">self</span><span class="o">.</span><span class="n">current_plottable</span><span class="p">])</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">plotname</span> <span class="o">=</span> <span class="n">dataset</span>
+        <span class="c">#self.control_panel.nfunc = self.nfunc</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">d_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_length</span>
+        <span class="c">#self.parent.set_perspective(self.perspective)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">_on_invert</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
+            
+    <span class="k">def</span> <span class="nf">get_panels</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">):</span>
+<div class="viewcode-block" id="Plugin.get_panels"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.get_panels">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Create and return a list of panel objects</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="kn">from</span> <span class="nn">inversion_panel</span> <span class="kn">import</span> <span class="n">InversionControl</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">frame</span> <span class="o">=</span> <span class="n">MDIFrame</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;None&#39;</span><span class="p">,</span> <span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">200</span><span class="p">))</span>     
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span> <span class="o">=</span> <span class="n">InversionControl</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">frame</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</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">RAISED_BORDER</span><span class="p">,</span>
+                                              <span class="n">standalone</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">standalone</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">frame</span><span class="o">.</span><span class="n">set_panel</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_frame_set_helper</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">set_manager</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">d_max</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_length</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">perspective</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">perspective</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">window_name</span><span class="p">)</span>
+     
+        <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="p">]</span>
+        
+    <span class="k">def</span> <span class="nf">set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.set_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.set_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        receive a list of data to compute pr</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="n">data_list</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+            <span class="n">data_list</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">1</span><span class="p">:</span>
+            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="n">data</span> <span class="o">=</span> <span class="n">data_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="n">data_1d_list</span> <span class="o">=</span> <span class="p">[]</span>
+                <span class="n">data_2d_list</span> <span class="o">=</span> <span class="p">[]</span>
+                <span class="n">error_msg</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
+                <span class="c"># separate data into data1d and data2d list</span>
+                <span class="k">for</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">data_list</span><span class="p">:</span>
+                    <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+                        <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">):</span>
+                            <span class="n">data_1d_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="n">error_msg</span> <span class="o">+=</span> <span class="s">&quot; </span><span class="si">%s</span><span class="s">  type </span><span class="si">%s</span><span class="s"> </span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">name</span><span class="p">),</span>
+                                             <span class="nb">str</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">))</span>
+                            <span class="n">data_2d_list</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_2d_list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;PrView does not support the following data types:</span><span class="se">\n</span><span class="s">&quot;</span>
+                    <span class="n">msg</span> <span class="o">+=</span> <span class="n">error_msg</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_1d_list</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                    <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;error&#39;</span><span class="p">))</span>
+                    <span class="k">return</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Prview does not allow multiple data!</span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;Please select one.</span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
+                    <span class="kn">from</span> <span class="nn">pr_widgets</span> <span class="kn">import</span> <span class="n">DataDialog</span>
+                    <span class="n">dlg</span> <span class="o">=</span> <span class="n">DataDialog</span><span class="p">(</span><span class="n">data_list</span><span class="o">=</span><span class="n">data_1d_list</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="n">msg</span><span class="p">)</span>
+                    <span class="k">if</span> <span class="n">dlg</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span> <span class="o">==</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">:</span>
+                        <span class="n">data</span> <span class="o">=</span> <span class="n">dlg</span><span class="o">.</span><span class="n">get_data</span><span class="p">()</span>
+                    <span class="k">else</span><span class="p">:</span>
+                        <span class="n">data</span> <span class="o">=</span> <span class="bp">None</span>
+                    <span class="n">dlg</span><span class="o">.</span><span class="n">Destroy</span><span class="p">()</span>
+            <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;PrView receives no data. </span><span class="se">\n</span><span class="s">&quot;</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                     <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;error&#39;</span><span class="p">))</span>
+                <span class="k">return</span>
+            <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">Data1D</span><span class="p">):</span>
+                <span class="k">try</span><span class="p">:</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">NewPlotEvent</span><span class="p">(</span><span class="n">action</span><span class="o">=</span><span class="s">&#39;remove&#39;</span><span class="p">,</span>
+                                                <span class="n">group_id</span><span class="o">=</span><span class="n">GROUP_ID_IQ_DATA</span><span class="p">,</span> 
+                                                <span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data_id</span><span class="p">))</span>
+                                              
+                    <span class="bp">self</span><span class="o">.</span><span class="n">data_id</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">id</span>
+                    <span class="bp">self</span><span class="o">.</span><span class="n">control_panel</span><span class="o">.</span><span class="n">_change_file</span><span class="p">(</span><span class="n">evt</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">)</span>
+                <span class="k">except</span><span class="p">:</span>
+                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Prview Set_data: &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+                    <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span>
+                                                            <span class="n">info</span><span class="o">=</span><span class="s">&quot;error&quot;</span><span class="p">))</span>
+            <span class="k">else</span><span class="p">:</span>    
+                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Pr cannot be computed for data of &quot;</span>
+                <span class="n">msg</span> <span class="o">+=</span> <span class="s">&quot;type </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">data_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
+                <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> 
+                         <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;error&#39;</span><span class="p">))</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Pr contain no data&quot;</span>
+            <span class="n">wx</span><span class="o">.</span><span class="n">PostEvent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">StatusEvent</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">msg</span><span class="p">,</span> <span class="n">info</span><span class="o">=</span><span class="s">&#39;warning&#39;</span><span class="p">))</span>
+            
+    <span class="k">def</span> <span class="nf">post_init</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="Plugin.post_init"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr.Plugin.post_init">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">            Post initialization call back to close the loose ends</span>
+<span class="sd">            [Somehow openGL needs this call]</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">standalone</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set_perspective</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">perspective</span><span class="p">)</span>
+  
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span></div></div>
+    <span class="n">i</span> <span class="o">=</span> <span class="n">Plugin</span><span class="p">()</span>
+    <span class="k">print</span> <span class="n">i</span><span class="o">.</span><span class="n">perform_estimateNT</span><span class="p">()</span>
+    
+    
+    
+    
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/pr/pr_thread.html
===================================================================
--- _modules/sas/perspectives/pr/pr_thread.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/pr/pr_thread.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,228 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.pr.pr_thread &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="Module code" href="../../../index.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" accesskey="U">Module code</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.pr.pr_thread</h1><div class="highlight"><pre>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation. </span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+
+<span class="kn">import</span> <span class="nn">sys</span>
+<span class="kn">import</span> <span class="nn">time</span>
+<span class="kn">from</span> <span class="nn">sas.data_util.calcthread</span> <span class="kn">import</span> <span class="n">CalcThread</span>
+
+<span class="k">class</span> <span class="nc">CalcPr</span><span class="p">(</span><span class="n">CalcThread</span><span class="p">):</span>
+<div class="viewcode-block" id="CalcPr"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_thread.CalcPr">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Compute P(r)</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pr</span><span class="p">,</span> <span class="n">nfunc</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">error_func</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">completefn</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">updatefn</span>   <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">yieldtime</span>  <span class="o">=</span> <span class="mf">0.01</span><span class="p">,</span>
+                 <span class="n">worktime</span>   <span class="o">=</span> <span class="mf">0.01</span>
+                 <span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">CalcThread</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">completefn</span><span class="p">,</span>
+                 <span class="n">updatefn</span><span class="p">,</span>
+                 <span class="n">yieldtime</span><span class="p">,</span>
+                 <span class="n">worktime</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pr</span> <span class="o">=</span> <span class="n">pr</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="n">nfunc</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">error_func</span> <span class="o">=</span> <span class="n">error_func</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="mi">0</span>
+        
+    <span class="k">def</span> <span class="nf">compute</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="CalcPr.compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_thread.CalcPr.compute">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Perform P(r) inversion</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+            <span class="n">out</span><span class="p">,</span> <span class="n">cov</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">invert</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">)</span>
+            <span class="c">#out, cov = self.pr.lstsq(self.nfunc)</span>
+            <span class="c">#out, cov = self.pr.invert_optimize(self.nfunc)</span>
+            <span class="n">elapsed</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span><span class="o">-</span><span class="bp">self</span><span class="o">.</span><span class="n">starttime</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">(</span><span class="n">out</span><span class="o">=</span><span class="n">out</span><span class="p">,</span> <span class="n">cov</span><span class="o">=</span><span class="n">cov</span><span class="p">,</span> <span class="n">pr</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="p">,</span> <span class="n">elapsed</span><span class="o">=</span><span class="n">elapsed</span><span class="p">)</span>
+        <span class="k">except</span> <span class="ne">KeyboardInterrupt</span><span class="p">:</span>
+            <span class="c"># Thread was interrupted, just proceed</span>
+            <span class="k">pass</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_func</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">error_func</span><span class="p">(</span><span class="s">&quot;CalcPr.compute: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+
+<span class="k">class</span> <span class="nc">EstimatePr</span><span class="p">(</span><span class="n">CalcThread</span><span class="p">):</span></div></div>
+<div class="viewcode-block" id="EstimatePr"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_thread.EstimatePr">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Estimate P(r)</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pr</span><span class="p">,</span> <span class="n">nfunc</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">error_func</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">completefn</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">updatefn</span>   <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">yieldtime</span>  <span class="o">=</span> <span class="mf">0.01</span><span class="p">,</span>
+                 <span class="n">worktime</span>   <span class="o">=</span> <span class="mf">0.01</span>
+                 <span class="p">):</span>
+        <span class="n">CalcThread</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">completefn</span><span class="p">,</span>
+                 <span class="n">updatefn</span><span class="p">,</span>
+                 <span class="n">yieldtime</span><span class="p">,</span>
+                 <span class="n">worktime</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pr</span> <span class="o">=</span> <span class="n">pr</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="n">nfunc</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">error_func</span> <span class="o">=</span> <span class="n">error_func</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="mi">0</span>
+        
+    <span class="k">def</span> <span class="nf">compute</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="EstimatePr.compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_thread.EstimatePr.compute">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Calculates the estimate</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>            
+            <span class="n">alpha</span><span class="p">,</span> <span class="n">message</span><span class="p">,</span> <span class="n">elapsed</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">estimate_alpha</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">isquit</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">(</span><span class="n">alpha</span><span class="o">=</span><span class="n">alpha</span><span class="p">,</span> <span class="n">message</span><span class="o">=</span><span class="n">message</span><span class="p">,</span> <span class="n">elapsed</span><span class="o">=</span><span class="n">elapsed</span><span class="p">)</span>
+        <span class="k">except</span> <span class="ne">KeyboardInterrupt</span><span class="p">:</span>
+            <span class="c"># Thread was interrupted, just proceed</span>
+            <span class="k">pass</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_func</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">error_func</span><span class="p">(</span><span class="s">&quot;EstimatePr.compute: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+
+<span class="k">class</span> <span class="nc">EstimateNT</span><span class="p">(</span><span class="n">CalcThread</span><span class="p">):</span></div></div>
+<div class="viewcode-block" id="EstimateNT"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_thread.EstimateNT">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pr</span><span class="p">,</span> <span class="n">nfunc</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">error_func</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
+                 <span class="n">completefn</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">updatefn</span>   <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
+                 <span class="n">yieldtime</span>  <span class="o">=</span> <span class="mf">0.01</span><span class="p">,</span>
+                 <span class="n">worktime</span>   <span class="o">=</span> <span class="mf">0.01</span>
+                 <span class="p">):</span>
+        <span class="n">CalcThread</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">completefn</span><span class="p">,</span>
+                 <span class="n">updatefn</span><span class="p">,</span>
+                 <span class="n">yieldtime</span><span class="p">,</span>
+                 <span class="n">worktime</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">pr</span> <span class="o">=</span> <span class="n">pr</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">nfunc</span> <span class="o">=</span> <span class="n">nfunc</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">error_func</span> <span class="o">=</span> <span class="n">error_func</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">starttime</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_time_for_sleep</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sleep_delay</span> <span class="o">=</span> <span class="mf">1.0</span>
+
+
+    <span class="k">def</span> <span class="nf">isquit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="EstimateNT.isquit"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_thread.EstimateNT.isquit">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">CalcThread</span><span class="o">.</span><span class="n">isquit</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
+        <span class="k">if</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span><span class="o">&gt;</span><span class="bp">self</span><span class="o">.</span><span class="n">_time_for_sleep</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">_sleep_delay</span><span class="p">:</span>
+            <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="o">.</span><span class="mi">2</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_time_for_sleep</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+
+    <span class="k">def</span> <span class="nf">compute</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="EstimateNT.compute"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_thread.EstimateNT.compute">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Calculates the estimate</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">try</span><span class="p">:</span>            
+            <span class="n">t_0</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_time_for_sleep</span> <span class="o">=</span> <span class="n">t_0</span>
+            <span class="n">nterms</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="n">message</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pr</span><span class="o">.</span><span class="n">estimate_numterms</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">isquit</span><span class="p">)</span>
+            <span class="n">t_1</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span><span class="o">-</span><span class="n">t_0</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">isquit</span><span class="p">()</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">complete</span><span class="p">(</span><span class="n">nterms</span><span class="o">=</span><span class="n">nterms</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="n">alpha</span><span class="p">,</span> <span class="n">message</span><span class="o">=</span><span class="n">message</span><span class="p">,</span> <span class="n">elapsed</span><span class="o">=</span><span class="n">t_1</span><span class="p">)</span>
+        <span class="k">except</span> <span class="ne">KeyboardInterrupt</span><span class="p">:</span>
+            <span class="c"># Thread was interrupted, just proceed</span>
+            <span class="k">pass</span>
+        <span class="k">except</span><span class="p">:</span>
+            <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_func</span><span class="o">==</span><span class="bp">None</span><span class="p">:</span>
+                <span class="bp">self</span><span class="o">.</span><span class="n">error_func</span><span class="p">(</span><span class="s">&quot;EstimatePr2.compute: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_value</span><span class="p">)</span>
+</pre></div></div></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
Index: _modules/sas/perspectives/pr/pr_widgets.html
===================================================================
--- _modules/sas/perspectives/pr/pr_widgets.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/perspectives/pr/pr_widgets.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,324 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>sas.perspectives.pr.pr_widgets &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../../',
+        VERSION:     '3.0.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
+      };
+    </script>
+    <script type="text/javascript" src="../../../../_static/jquery.js"></script>
+    <script type="text/javascript" src="../../../../_static/underscore.js"></script>
+    <script type="text/javascript" src="../../../../_static/doctools.js"></script>
+    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../../index.html" />
+    <link rel="up" title="Module code" href="../../../index.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" accesskey="U">Module code</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.perspectives.pr.pr_widgets</h1><div class="highlight"><pre>
+<span class="c">################################################################################</span>
+<span class="c">#This software was developed by the University of Tennessee as part of the</span>
+<span class="c">#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)</span>
+<span class="c">#project funded by the US National Science Foundation. </span>
+<span class="c">#</span>
+<span class="c">#See the license text in license.txt</span>
+<span class="c">#</span>
+<span class="c">#copyright 2009, University of Tennessee</span>
+<span class="c">################################################################################</span>
+
+<span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">Text controls for input/output of the main PrView panel</span>
+<span class="sd">&quot;&quot;&quot;</span>
+
+<span class="kn">import</span> <span class="nn">wx</span>
+<span class="kn">import</span> <span class="nn">os</span>
+<span class="kn">from</span> <span class="nn">wx.lib.scrolledpanel</span> <span class="kn">import</span> <span class="n">ScrolledPanel</span>
+
+<span class="n">WIDTH</span> <span class="o">=</span> <span class="mi">400</span>
+<span class="n">HEIGHT</span> <span class="o">=</span> <span class="mi">350</span>
+
+
+<span class="k">class</span> <span class="nc">DialogPanel</span><span class="p">(</span><span class="n">ScrolledPanel</span><span class="p">):</span>
+<div class="viewcode-block" id="DialogPanel"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_widgets.DialogPanel">[docs]</a>    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">ScrolledPanel</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetupScrolling</span><span class="p">()</span>
+        
+        
+<span class="k">class</span> <span class="nc">PrTextCtrl</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span></div>
+<div class="viewcode-block" id="PrTextCtrl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_widgets.PrTextCtrl">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Text control for model and fit parameters.</span>
+<span class="sd">    Binds the appropriate events for user interactions.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        
+        <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        
+        <span class="c">## Set to True when the mouse is clicked while the whole string is selected</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span> <span class="o">=</span> <span class="bp">False</span>
+        <span class="c">## Call back for EVT_SET_FOCUS events</span>
+        <span class="n">_on_set_focus_callback</span> <span class="o">=</span> <span class="bp">None</span>
+        <span class="c"># Bind appropriate events</span>
+        <span class="bp">self</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_LEFT_UP</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_highlight_text</span><span class="p">)</span>
+        <span class="bp">self</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_SET_FOCUS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_set_focus</span><span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">_on_set_focus</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Catch when the text control is set in focus to highlight the whole</span>
+<span class="sd">        text if necessary</span>
+<span class="sd">        </span>
+<span class="sd">        :param event: mouse event</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span> <span class="o">=</span> <span class="bp">True</span>
+        
+    <span class="k">def</span> <span class="nf">_highlight_text</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Highlight text of a TextCtrl only of no text has be selected</span>
+<span class="sd">        </span>
+<span class="sd">        :param event: mouse event</span>
+<span class="sd">        </span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c"># Make sure the mouse event is available to other listeners</span>
+        <span class="n">event</span><span class="o">.</span><span class="n">Skip</span><span class="p">()</span>
+        <span class="n">control</span>  <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">GetEventObject</span><span class="p">()</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">full_selection</span> <span class="o">=</span> <span class="bp">False</span>
+            <span class="c"># Check that we have a TextCtrl</span>
+            <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">control</span><span class="o">.</span><span class="n">__class__</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span>
+                <span class="c"># Check whether text has been selected, </span>
+                <span class="c"># if not, select the whole string</span>
+                <span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> <span class="o">=</span> <span class="n">control</span><span class="o">.</span><span class="n">GetSelection</span><span class="p">()</span>
+                <span class="k">if</span> <span class="n">start</span><span class="o">==</span><span class="n">end</span><span class="p">:</span>
+                    <span class="n">control</span><span class="o">.</span><span class="n">SetSelection</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+
+<span class="k">class</span> <span class="nc">OutputTextCtrl</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="p">):</span></div>
+<div class="viewcode-block" id="OutputTextCtrl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_widgets.OutputTextCtrl">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Text control used to display outputs.</span>
+<span class="sd">    No editing allowed. The background is </span>
+<span class="sd">    grayed out. User can&#39;t select text.</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">TextCtrl</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetBackgroundColour</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">GetParent</span><span class="p">()</span><span class="o">.</span><span class="n">GetBackgroundColour</span><span class="p">())</span>
+        
+        <span class="c"># Bind to mouse event to avoid text highlighting</span>
+        <span class="c"># The event will be skipped once the call-back</span>
+        <span class="c"># is called.</span>
+        <span class="bp">self</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_MOUSE_EVENTS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_click</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">_click</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">event</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Prevent further handling of the mouse event</span>
+<span class="sd">        by not calling Skip().</span>
+<span class="sd">        &quot;&quot;&quot;</span> 
+        <span class="k">pass</span>
+        
+
+<span class="k">class</span> <span class="nc">DataFileTextCtrl</span><span class="p">(</span><span class="n">OutputTextCtrl</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataFileTextCtrl"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_widgets.DataFileTextCtrl">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Text control used to display only the file name</span>
+<span class="sd">    given a full path.</span>
+<span class="sd">     </span>
+<span class="sd">    :TODO: now that we no longer choose the data file from the panel,</span>
+<span class="sd">        it&#39;s no longer necessary to pass around the file path. That code</span>
+<span class="sd">        should be refactored away and simplified. </span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="n">OutputTextCtrl</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_complete_path</span> <span class="o">=</span> <span class="bp">None</span>
+    
+    <span class="k">def</span> <span class="nf">SetValue</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
+<div class="viewcode-block" id="DataFileTextCtrl.SetValue"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_widgets.DataFileTextCtrl.SetValue">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Sets the file name given a path</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_complete_path</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
+        <span class="nb">file</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_complete_path</span><span class="p">)</span>
+        <span class="n">OutputTextCtrl</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">file</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">GetValue</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataFileTextCtrl.GetValue"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_widgets.DataFileTextCtrl.GetValue">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        Return the full path</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_complete_path</span>
+    
+
+            
+            
+<span class="k">def</span> <span class="nf">load_error</span><span class="p">(</span><span class="n">error</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span></div></div>
+<div class="viewcode-block" id="load_error"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_widgets.load_error">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Pop up an error message.</span>
+<span class="sd">    </span>
+<span class="sd">    :param error: details error message to be displayed</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="n">message</span> <span class="o">=</span> <span class="s">&quot;The data file you selected could not be loaded.</span><span class="se">\n</span><span class="s">&quot;</span>
+    <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;Make sure the content of your file is properly formatted.</span><span class="se">\n\n</span><span class="s">&quot;</span>
+    
+    <span class="k">if</span> <span class="n">error</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
+        <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot;When contacting the DANSE team, mention the&quot;</span>
+        <span class="n">message</span> <span class="o">+=</span> <span class="s">&quot; following:</span><span class="se">\n</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">error</span><span class="p">)</span>
+    
+    <span class="n">dial</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">MessageDialog</span><span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="n">message</span><span class="p">,</span> <span class="s">&#39;Error Loading File&#39;</span><span class="p">,</span>
+                            <span class="n">wx</span><span class="o">.</span><span class="n">OK</span> <span class="o">|</span> <span class="n">wx</span><span class="o">.</span><span class="n">ICON_EXCLAMATION</span><span class="p">)</span>
+    <span class="n">dial</span><span class="o">.</span><span class="n">ShowModal</span><span class="p">()</span>    
+
+    
+<span class="k">class</span> <span class="nc">DataDialog</span><span class="p">(</span><span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="p">):</span></div>
+<div class="viewcode-block" id="DataDialog"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_widgets.DataDialog">[docs]</a>    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    Allow file selection at loading time</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">):</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">WIDTH</span><span class="p">,</span> <span class="n">HEIGHT</span><span class="p">)</span>
+        <span class="n">kwds</span><span class="p">[</span><span class="s">&#39;title&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Data Selection&quot;</span>
+        <span class="n">wx</span><span class="o">.</span><span class="n">Dialog</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwds</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_of_ctrl</span> <span class="o">=</span> <span class="p">[]</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</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>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_choice_sizer</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">GridBagSizer</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_panel</span> <span class="o">=</span> <span class="n">DialogPanel</span><span class="p">(</span><span class="bp">self</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">RAISED_BORDER</span><span class="p">,</span>
+                               <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="n">WIDTH</span><span class="o">-</span><span class="mi">20</span><span class="p">,</span> <span class="n">HEIGHT</span><span class="o">/</span><span class="mi">3</span><span class="p">))</span>
+       
+        <span class="bp">self</span><span class="o">.</span><span class="n">__do_layout</span><span class="p">(</span><span class="n">data_list</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="n">text</span><span class="p">)</span>
+        
+        
+    <span class="k">def</span> <span class="nf">__do_layout</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data_list</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>
+        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        layout the dialog</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="c">#if not data_list or len(data_list) &lt;= 1:</span>
+        <span class="c">#    return </span>
+        <span class="c">#add text</span>
+        <span class="k">if</span> <span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
+            <span class="n">text</span> <span class="o">=</span> <span class="s">&quot;This Perspective does not allow multiple data !</span><span class="se">\n</span><span class="s">&quot;</span>
+            <span class="n">text</span> <span class="o">+=</span> <span class="s">&quot;Please select only one Data.</span><span class="se">\n</span><span class="s">&quot;</span>
+        <span class="n">text_ctrl</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="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">text</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_MULTILINE</span><span class="p">,</span>
+                                <span class="n">size</span><span class="o">=</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">HEIGHT</span><span class="o">/</span><span class="mi">3</span><span class="p">))</span>
+        <span class="n">text_ctrl</span><span class="o">.</span><span class="n">SetEditable</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">text_ctrl</span> <span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">iy</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">ix</span> <span class="o">=</span> <span class="mi">0</span>
+        <span class="n">rbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_panel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">data_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> 
+                                  <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</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">RB_GROUP</span><span class="p">)</span>
+        <span class="n">rbox</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">list_of_ctrl</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">rbox</span><span class="p">,</span> <span class="n">data_list</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_choice_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">rbox</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
+                         <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">data_list</span><span class="p">)):</span>
+            <span class="n">iy</span> <span class="o">+=</span> <span class="mi">1</span>
+            <span class="n">rbox</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">RadioButton</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_panel</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> 
+                                  <span class="nb">str</span><span class="p">(</span><span class="n">data_list</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> <span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span>
+            <span class="n">rbox</span><span class="o">.</span><span class="n">SetValue</span><span class="p">(</span><span class="bp">False</span><span class="p">)</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">list_of_ctrl</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">rbox</span><span class="p">,</span> <span class="n">data_list</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">_choice_sizer</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">rbox</span><span class="p">,</span> <span class="p">(</span><span class="n">iy</span><span class="p">,</span> <span class="n">ix</span><span class="p">),</span>
+                           <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">wx</span><span class="o">.</span><span class="n">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_panel</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_choice_sizer</span><span class="p">)</span>
+        <span class="c">#add sizer</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">((</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="n">button_cancel</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_CANCEL</span><span class="p">,</span> <span class="s">&quot;Cancel&quot;</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_cancel</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">button_OK</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">Button</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">wx</span><span class="o">.</span><span class="n">ID_OK</span><span class="p">,</span> <span class="s">&quot;Ok&quot;</span><span class="p">)</span>
+        <span class="n">button_OK</span><span class="o">.</span><span class="n">SetFocus</span><span class="p">()</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">button_OK</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">LEFT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">RIGHT</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ADJUST_MINSIZE</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="n">static_line</span> <span class="o">=</span> <span class="n">wx</span><span class="o">.</span><span class="n">StaticLine</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+        
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_panel</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sizer_txt</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">static_line</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">EXPAND</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sizer_button</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">EXPAND</span><span class="o">|</span><span class="n">wx</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">SetSizer</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_sizer_main</span><span class="p">)</span>
+        
+    <span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+<div class="viewcode-block" id="DataDialog.get_data"><a class="viewcode-back" href="../../../../dev/api/sas.perspectives.pr.html#sas.perspectives.pr.pr_widgets.DataDialog.get_data">[docs]</a>        <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">        return the selected data</span>
+<span class="sd">        &quot;&quot;&quot;</span>
+        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">list_of_ctrl</span><span class="p">:</span>
+            <span class="n">rbox</span><span class="p">,</span> <span class="n">data</span> <span class="o">=</span> <span class="n">item</span>
+            <span class="k">if</span> <span class="n">rbox</span><span class="o">.</span><span class="n">GetValue</span><span class="p">():</span>
+                <span class="k">return</span> <span class="n">data</span> 
+
+    
+
+ 
+</pre></div></div></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../../index.html" >Module code</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
